[mailto:users-boun...@racket-lang.org]
On Behalf Of J G Cho
Sent: sábado, 16 de febrero de 2013 3:55
To: Racket mailing list
Subject: [racket] lambda as default value to dict-ref
So, I have a dict A that looks like (list ("string as key" . (lambda
(arg) ...) ...)
I do ((dict-ref A key (lambda
If the third argument to `dict-ref' (and `hash-ref') is a function,
then the function is called as a failure thunk. If the third argument
is any other kind of value, then the value is returned as the result in
case of failure.
This is convenient but, yes, potentially confusing.
If you want a defa
So, I have a dict A that looks like (list ("string as key" . (lambda
(arg) ...) ...)
I do ((dict-ref A key (lambda (_) "wrong key")) some-params).
When keys are valid the above work as expected. When the key does not
find any, I was expecting
((lambda (_) "wrong key") some-params) but it fails w
3 matches
Mail list logo