This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

let not binding correctly?


The following code fails on Guile 1.2...

  (define symtable (make-vector 11))
  (vector-fill! symtable ())

  (intern-symbol symtable 'hello)
  (symbol-set! symtable 'hello 3)

  (intern-symbol symtable 'there)

  (define robtest
    (lambda ()
        (for-each
            (lambda (bucket)
                (write-line bucket)
                (for-each
                    (lambda (elem) 
                        (let ((one (car elem)) (two (cdr elem)))
                            (write-line (cons one two))
                        )
                    )
                    bucket
                )
            )
            (vector->list symtable)
        )
    )
  )

  (robtest)

with...

  ()
  ((there . #<undefined>))
  /tmp/y:17:40: While evaluating arguments to cons in expression (cons
one two):
  /tmp/y:17:40: Unbound variable: two
  ABORT: (misc-error)

If I change the "let" to "let*" it works...

If I change the symtable to the following (swapping "hello" and "there")
it also works...

  (define symtable (make-vector 11))
  (vector-fill! symtable ())

  (intern-symbol symtable 'there)
  (symbol-set! symtable 'there 3)

  (intern-symbol symtable 'hello)

Anybody have any ideas why?

Thanks!
Rob
-- 
------------------------------------------------------------------------
Rob Engle                                      grenoble@spimageworks.com
Sony Pictures Imageworks                             voice: 310-840-8203
9050 West Washington Boulevard                         fax: 310-840-8567
Culver City, CA  90232
------------------------------------------------------------------------