thanks James,
I'll have a look.

-sun


On Jan 25, 2:00 pm, James Reeves <weavejes...@googlemail.com> wrote:
> On Jan 25, 5:34 pm, wubbie <sunj...@gmail.com> wrote:
>
> > What's the typical usage of fn constantly ?
>
> When you need a function that constantly returns the same result :)
>
> That probably doesn't tell you any more than you know already, so I'll
> give you a real world use. My rnd-utils library has a function
> generating random strings that match a regular expression. It does
> this by converting a regex into a sequence of functions, and then
> concatenating the results into a string.
>
> So a regex like "ab[def]" would be converted into two functions:
> [(constantly "ab") (rnd-choice "def")]
>
> This can then be turned into a string using: (apply str (map apply
> function-sequence))
>
> - James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to