On Wed, Apr 26, 2017 at 12:48 PM, David Storrs <david.sto...@gmail.com> wrote:
> On Wed, Apr 26, 2017 at 12:21 AM, Jon Zeppieri <zeppi...@gmail.com> wrote:
>> I don't know that there's a right way, but if your functions are
>> nullary, then promises are a decent fit:
>> (define conf
>> (with-input-from-file ...)))
>> Then just (force conf) whenever you want the value.
> Yeah, that works well. Thanks!
> Any thoughts on how to do it for non-nullary functions?
The more complicated your function signatures get, the more worthwhile
it will be to use the memoize package. But for, say, unary functions
you can easily use a hash table:
(let ([h (make-hash)])
You can extend this to multiple arguments by using lists as keys, if
you want. Of course, you need to make sure that `equal?` is usefully
defined on your argument types.
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.