On Sat, 5 Apr 2014, Thomas Chust wrote:
On 2014-04-05 01:54, Claude Marinier wrote:[...] I would like to have the compiler do some of this for me. I probably cannot write a literal hash table but I expected to be able to write a literal association list. I have tried this but it does not work. [...] (define a-list `( (dot . ,(lambda () (display "dot\n"))) (dash . ,(lambda () (display "dash\n"))) )) [...]Hello, what you have written down here is not a literal list, but a quasiquotation, which is just syntactic sugar that expands to an expression dynamically constructing a list. Nevertheless, the program you posted works just fine as it is. The only problem I can see with it is that nothing visible happens because[...] (let ((func-dot (hash-table-ref dict 'dot)) (func-dash (hash-table-ref dict 'dash))) func-dot func-dash) [...]doesn't call the two procedures. To actually run the procedures, you would have to write something like (let ((func-dot (hash-table-ref dict 'dot)) (func-dash (hash-table-ref dict 'dash))) (func-dot) (func-dash))
That works. Thank you. I was so close. I think I lost track of the many variations I tried. :-( -- Claude Marinier _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
