Re: always function?

2013-08-25 Thread Dave Della Costa
That's what I get for posting late on a Sunday. I see now I misread your request as a desire for a function that always returns its argument, but it's clear now what you were looking for and constantly is exactly it. Sorry for the noise! (2013/08/25 21:02), Christian Sperandio wrote: > Not reall

Re: always function?

2013-08-25 Thread Christian Sperandio
Not really. The identity function returns the value. I want to have the function that returns the value. constantly is the good answer for my needs. Le 25 août 2013 à 13:57, Dave Della Costa a écrit : > There is also identity, which returns what it was passed, which seems > closer to what you

Re: always function?

2013-08-25 Thread Christian Sperandio
Thank you :) -- -- 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, se

Re: always function?

2013-08-25 Thread Dave Della Costa
There is also identity, which returns what it was passed, which seems closer to what you described initially. => (identity "foo") "foo" (2013/08/25 20:41), Christian Sperandio wrote: > Thanks, exactly what I want :) > > Le 25 aoűt 2013 ŕ 13:40, László Török > a écrit

Re: always function?

2013-08-25 Thread Christian Sperandio
Thanks, exactly what I want :) Le 25 août 2013 à 13:40, László Török a écrit : > Hi, > > (constantly 5) > > will return a function that takes any number of args and always returns 5. > > See http://clojuredocs.org/clojure_core/clojure.core/constantly. > > Las > > > 2013/8/25 Christian Sper

Re: always function?

2013-08-25 Thread Cedric Greevey
(constantly x), I think, accepts various arities including unary. user=> ((constantly 3) 5) 3 user=> On Sun, Aug 25, 2013 at 7:34 AM, Christian Sperandio < christian.speran...@gmail.com> wrote: > Hi, > > Is there a function builds a function that returns always the same value? > > In coder wor

Re: always function?

2013-08-25 Thread László Török
Hi, (constantly 5) will return a function that takes any number of args and always returns 5. See http://clojuredocs.org/clojure_core/clojure.core/constantly. Las 2013/8/25 Christian Sperandio > Hi, > > Is there a function builds a function that returns always the same value? > > In coder w

always function?

2013-08-25 Thread Christian Sperandio
Hi, Is there a function builds a function that returns always the same value? In coder words, this sort of function: (defn always [v] (fn [& _] v)) If this function exists already, I prefer use it rather than reinvent the wheel :) Christian -- -- You received this message because you ar