Subject: Re: Haskell --- Scheme --- ML
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1 Sep 2000 14:06:53 GMT
Newsgroups: comp.lang.ml,comp.lang.scheme
Message-ID: <8ood5t$nad$1@cantaloupe.srv.cs.cmu.edu>
Albert Y. C. Lai <trebla@vex.net> wrote:
+---------------
| Distinguishing Scheme from {ML, Haskell}:
...
| - this one I am not sure, please correct me: currying is not convenient
|   or natural
+---------------

Well, I usually find it quite convenient enough for my simpleminded purposes:

	> (define (curry-left f . args)
	    (lambda x (apply f (append args x))))
	> (define (curry-right f . args)
	    (lambda x (apply f (append x args))))
	> (map (curry-right / 2) '(0 1 2 3 4 5 6))
	(0 1/2 1 3/2 2 5/2 3)
	> (map (curry-left / 2) '(1 2 3 4 5 6))
	(2 1 2/3 1/2 2/5 1/3)
	> (define debug (curry-left print* "DEBUG: "))
	> (debug '(+ 2 3) " = " (+ 2 3))
	DEBUG: (+ 2 3) = 5
	> 

-Rob

-----
Rob Warnock, 41L-955		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043