Bonjour,
I can add lambdas to a hash table at run time, retrieve them, and execute
them. This is very useful.
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.
(declare (uses srfi-69))
(define a-list
`(
(dot . ,(lambda () (display "dot\n")))
(dash . ,(lambda () (display "dash\n")))
))
(define dict
(alist->hash-table a-list))
(let ((func-dot (hash-table-ref dict 'dot))
(func-dash (hash-table-ref dict 'dash)))
func-dot
func-dash)
I have tried various ways of quoting but have not yet found something
which works.
Can this be done or do I have to create it when the program starts?
Merci.
--
Claude Marinier
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users