chickadee » srfi-225 » dict-ref

dict-ref dto dict key #!optional failure successprocedure

If key is the same as some key of dict, then invokes success on the corresponding value and returns its result. If key is not a key of dict, then invokes the thunk failure and returns its result. The default value of failure signals an error; the default value of success is the identity procedure.

(dict-ref dto dict 1 (lambda () '()) list)(2) ; Success wraps value in a list
(dict-ref dto dict 2 (lambda () '()) list)() ; Failure returns empty list