This is very cool!

Taken together with the following projects, Clojure now has some of
the nicest parts of Haskell/ML, IMHO :)

Matchure (pattern matching):
http://spin.atomicobject.com/2010/04/25/matchure-serious-clojure-pattern-matching

Algebraic Data Types:
http://clojure.github.com/clojure-contrib/types-api.html

On Dec 17, 7:00 pm, Sunil S Nandihalli <sunil.nandiha...@gmail.com>
wrote:
> On Sat, Dec 18, 2010 at 7:21 AM, Sunil S Nandihalli <
>
>
>
>
>
>
>
>
>
> sunil.nandiha...@gmail.com> wrote:
> > Hi Eric,
> >  I do know about partial. But what I am saying is that the extra function,
> > partial, is not necessary if the function was created with
> > def-curry-fn....... The function automatically returns a curried version
> > when called with fewer number of arguments than necessary.... like it
> > happens in haskell..
> > thanks,
> > Sunil.
>
> > On Sat, Dec 18, 2010 at 3:02 AM, Eric Schulte <schulte.e...@gmail.com>wrote:
>
> >> Hi Sunil,
>
> >> This is already possible using `partial' function in clojure core, which
> >> also works for variable arity functions, e.g.
>
> >> (map (partial reduce +) [[1 2 3 4] [5 6 7 8]])
>
> >> Best -- Eric
>
> >> Sunil S Nandihalli <sunil.nandiha...@gmail.com> writes:
>
> >> > Hello everybody,
> >> >  I remember that the key reasoning for not supporting currying in
> >> clojure
> >> > was to be able to have variable number of arg functions.. So, I just
> >> thought
> >> > a bit and realized that it should be possible to do that for fixed arity
> >> > functions .. and then wrote the following macro to define a curry-able
> >> > fixed-number-of-argument-function
>
> >> >https://gist.github.com/745654
>
> > If the following was defined as
>
> (defn f [a b c d]
>   (+ a b c d))
>
> >  > (def-curry-fn f [a b c d]
> >> >   (+ a b c d))
>
> >> > ((f 1) 2 3 4)  => 10
>
> > the above s-expression using partial would become ...
>
> ((partial f 1) 2 3 4) => 10
>
> >  > (((f 1 2) 3) 4) => 10
>
> and ((partial (partial f 1 2) 3) 4) => 10 instead of (((f 1 2) 3) 4)..
>
> ((((f 1) 2) 3) 4) => 10
> would become
> ((partial (partial (partial f 1) 2) 3) 4) => 10 .....
>
> I know there is no real practical utility .. .. it was just something I
> wrote for fun.. and thought of sharing it ...
> Sunil.
>
>
>
>
>
>
>
>
>
> >> > I just thought of sharing it with everybody. Would love to hear any
> >> > criticisms you may have.
>
> >> > Thanks for reading,
> >> > Sunil
>
> >> --
> >> 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, send email to
> >> clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com
> >>  >
> >> 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 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, 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