Hi,

"Shakthi Kannan" <[EMAIL PROTECTED]> writes:

> Newbie here. I am trying to pass key/value to a procedure to add it to
> the hash-table. It fails at:
>
> "you"ERROR: In procedure hash_fn_create_handle_x:
> ERROR: Wrong type argument in position 1: "foo"

Note: If you run Guile with `--debug', you should get a nice backtrace
here.

The problem is that you pass `hash-set!' the string "foo" as its first
argument, while it expects a hash table (as returned by
`make-hash-table').

I think there is some confusion:

> (define make-dictionary
>   (lambda (name size)
>     (lambda ()
>       (define name (make-hash-table size)))))

`define' here is an "internal define", i.e., it defines a variable
that's local to the lambda where it occurs.  Furthermore, `name' is
taken literally, it's not substituted by the actual parameter passed to
`make-dictionary'.

Hope this helps,
Ludovic.



Reply via email to