Ah, of course. Even though the guts of the function are ignoring the argument, `memoize` is using it. Cool!
Sam Ritchie (@sritchie) RaceHub Co-Founder 703.863.8561 www.racehubhq.com <http://www.racehubhq.com/> Twitter <http://twitter.com/racehubhq> // Facebook <http://facebook.com/racehubhq> > On Sep 12, 2015, at 3:24 AM, Moe Aboulkheir <[email protected]> wrote: > > > > On Sat, Sep 12, 2015 at 1:58 AM, Sam Ritchie <[email protected] > <mailto:[email protected]>> wrote: > Seems like a good use of “delay”, yeah? Slightly different calling semantics, > of course, but still: > > user> (def f (delay (gensym "node"))) > #'user/f > user> @f > node3330 > user> @f > node3330 > > The original code wanted different behaviour - a distinct gensym for each > distinct input. Memoize takes the ignored argument into account when > associating the inputs with outputs. > > user> (def mapped-gensym (memoize (fn [_] (gensym "alias")))) > > user> (mapped-gensym "HI") > alias29367 > user> (mapped-gensym "HI") > alias29367 > user> (mapped-gensym "NOT HI") > alias29372 > > Take care, > Moe > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > <http://groups.google.com/group/clojure?hl=en> > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
