Max et. al,

I'm impressed by your solutions to the problem. I still object to them  
in practice, though, because they depend on either extra up-front work  
(uncurry-n) or extra understanding on the part of the caller (:end,  
'() and calling without parameters).

Haskell and the other ML languages are able to support partial  
application for two reasons: they have a simpler notion of function,  
and they have a type-checking compiler to catch human errors.  
Hopefully kinghajj can forgive me for not knowing about Printf; in the  
two years I spent studying Haskell I never saw a user-defined variadic  
function nor in fact a call to the Printf library. I am under the  
impression the OCaml compiler does extra tricks just to support printf  
but even if it doesn't you won't find many variadic functions in OCaml  
either.

One thing I like about Clojure's #() syntax is that I can tell by  
looking at the code that what's being passed back is a function. In  
Haskell, the only way one knows whether you've got a function where  
you meant a value is through the compiler. Clojure's compiler isn't  
that sophisticated and hopefully never will be, it being a Lisp family  
language. This means some of the knowledge has to be either in the  
head of the user, the editor, or the code itself. Even knowing Haskell  
well, you will occasionally write "sum = foldr (+)" instead of "sum =  
foldr1 (+)" or "sum = foldr (+) 0". You survive because the compiler  
tells you you've screwed up.

Haskell's nature is to prefer a simple, mathematically complete  
facility over two more human-friendly facilities, so it has a  
simplified notion of function. Clojure's notion of function is more  
amenable to (some) humans and it would require extensive overhauling  
to support syntactic partial application cleanly. It wouldn't surprise  
me if it would need a Hindley-Milner type checker just to produce  
useful errors. To see the downside, notice that Haskell has map,  
zipWith, zipWith2, zipWith3, zipWith4, ... zipWith8 in the standard  
library. If you want to apply a function with 9 arguments to each  
value successively in 9 lists, you have to write your own function to  
do it. In Clojure, all of these are just map. Upsides and downsides.

With respect to eyeris, while there may not be a difference to the  
compiler between #(* % 2) and (fn [x] (* x 2)), there is a large  
difference to humans and not knowing when (* 2) is a function or a  
value would be sufficiently detrimental (IMO) to outweigh the  
benefits. Again with respect, because I think Haskell get great  
utility from this facility, but only because it exists in a Haskell  
universe with Haskell functions, Haskell error messages and Haskell  
typechecking. I just don't see how one could import this particular  
feature without importing a lot more of Haskell, destroying a lot of  
the value of Clojure in the process. And the utility of (* 2) over #(*  
2 %) seems pretty limited, and (partial * 2) doesn't seem that bad.

Perhaps there could be another reader macro, #p(* 2) or something,  
being the same as (partial * 2)? I would have to be more familiar with  
other people's code to know whether that would be generally useful.

Incidentally, have any of you taken a look at Liskell? <http://liskell.org/ 
 >

—
Daniel Lyons
http://www.storytotell.org -- Tell It!


--~--~---------~--~----~------------~-------~--~----~
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