Python syntax in Lisp and Scheme

Raffael Cavallaro raffaelcavallaro at junk.mail.me.not.mac.com
Tue Oct 14 18:28:38 EDT 2003


In article <y8vnhkcy.fsf at ccs.neu.edu>, Joe Marshall <jrm at ccs.neu.edu> 
wrote:

> The problem with this is that you've essentially outlawed MAP.
> 
>    (map 'list (make-adder offset) some-list)
> 
> The problem with this is that MAKE-ADDER is no less a lambda in drag,
> and it isn't even local.

I think you misunderstand me. I haven't outlawed map. I've simply asked 
that it be used in a _named_ function or macro that expresses _what_ is 
being done, not _how_. For example:

(defgeneric add-offset (some-sequence some-offset))

(defmethod add-offset ((some-list list) some-offset)
   (map 'list #'(lambda (x) (+ x some-offset)) some-list))

(defmethod add-offset ((some-vector vector) some-offset)
   (map 'vector #'(lambda (x) (+ x some-offset)) some-vector))


And the client code looks like your example:

(add-offset my-list current-offset)  or

(add-offset my-vector vector-offset)  etc.

Also see my reply to Thant Tessman entitled "Express What, not How."




More information about the Python-list mailing list