If the failure-result is a procedure, it is called without arguments. I quote part of the doc:
quote If failure-result is a procedure, it is called (through a tail call) with no arguments to produce the result. endquote Jos -----Original Message----- From: users-boun...@racket-lang.org [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 (_) "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 with this msg: arity mismatch; the expected number of arguments does not match the given number expected: 1 given: 0 Upon further inspection, (dict-ref A key (lambda (_) "wrong key")) does not seem to return the lambda but seems to invoke it. Why so? What am I failing to understand here? Confused, jGc ____________________ Racket Users list: http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users