[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Re: MACROS : now i see the power !

William James

8/8/2015 6:11:00 AM

> (loop for x below 10
> and (first last) in '((john smith) (betty wong))
> collecting (list first last x))

Gauche Scheme:

(map (lambda (x i) (append x (list i)))
'((John Smith) (Roger Jones))
(lrange 0))


Another way:

(use gauche.sequence :only (map-with-index))

(map-with-index (^(i x) `(,@x ,i)) '((John Smith) (Roger Jones)))
===>
((John Smith 0) (Roger Jones 1))


Another way:

(use srfi-42 :only (list-ec))

(list-ec (:list x (index i) '((John Smith) (Roger Jones)))
(append x (list i)))

--
The Authoritarian Personality extends beyond the attempt to pathologize
cohesive gentile groups to pathologizing adaptive gentile behavior in general.
The principal intellectual difficulty is that behavior that is critical to
Judaism as a successful group evolutionary strategy is conceptualized as
pathological in gentiles. --- Dr. Kevin MacDonald; "The Frankfurt School of
Social Research and the Pathologization of Gentile Group Allegiances"