Re: [racket-users] Storing functions in a hash

2015-05-20 Thread Norman Gray
j b, hello. Depending on what this is a cut-down version of, I think you may have slightly over-engineered it. > On 2015 May 20, at 13:41, j b wrote: > > ; function definition helper > (define-syntax-rule (define-hash-function f p ...) > (define (f) (lambda () p ...))) This defines f to be

Re: [racket-users] Storing functions in a hash

2015-05-20 Thread Matthias Felleisen
Yes, this is over-engineered. What do you not like about (define h1 (hash 'foo (lambda () (random 100)) 'bar (lambda () (random 500 (displayln h1) (displayln ((hash-ref h1 'foo))) (displayln ((hash-ref h1 'foo))) (displayln ((hash-ref h1 'bar))) (displayln ((hash-ref h1 'bar))) Onc

[racket-users] Storing functions in a hash

2015-05-20 Thread j b
I'm new to Racket/Scheme/Lisp. In addition to learning how to use the language, I also want to do it the "Racket way". I am trying to put functions into a hash so I could call them using a hash key lookup (I just use 'random' as a filler in this example for what I really want. I have it worki