[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: lisp from perl

William James

5/13/2015 9:40:00 AM

Rainer Joswig wrote:

> (let ((LoL '((1 2 3) (a b c))))
> (loop for list in LoL
> for i from 0
> do (loop for item in list
> for j from 0
> do (format t "~%element ~A of list ~A is ~A" j i item))))

Output:

element 0 of list 0 is 1
element 1 of list 0 is 2
element 2 of list 0 is 3
element 0 of list 1 is A
element 1 of list 1 is B
element 2 of list 1 is C

Gauche Scheme:

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

(let1 LoL '((1 2 3) (a b c))
(do-ec (: list (index i) LoL)
(: item (index j) list)
(print #"element ~j of list ~i is ~item")))

===>
element 0 of list 0 is 1
element 1 of list 0 is 2
element 2 of list 0 is 3
element 0 of list 1 is a
element 1 of list 1 is b
element 2 of list 1 is c

--
The Swedish supreme court has in a ruling in principle made clear the fact that
racism is something which is done by Swedes and not anyone else. This despite
many of the gang rapes, wherein by the way immigrants are massively
overrepresented as perpetrators, have clear racist traits.
fjordman.blogspot.ca/2005/05/is-swedish-democracy-collapsing.html
1 Answer

William James

1/23/2016 2:44:00 PM

0

WJ wrote:

> Rainer Joswig wrote:
>
> > (let ((LoL '((1 2 3) (a b c))))
> > (loop for list in LoL
> > for i from 0
> > do (loop for item in list
> > for j from 0
> > do (format t "~%element ~A of list ~A is ~A" j i item))))
>
> Output:
>
> element 0 of list 0 is 1
> element 1 of list 0 is 2
> element 2 of list 0 is 3
> element 0 of list 1 is A
> element 1 of list 1 is B
> element 2 of list 1 is C
>
> Gauche Scheme:
>
> (use srfi-42 :only (do-ec))
>
> (let1 LoL '((1 2 3) (a b c))
> (do-ec (: list (index i) LoL)
> (: item (index j) list)
> (print #"element ~j of list ~i is ~item")))
>
> ===>
> element 0 of list 0 is 1
> element 1 of list 0 is 2
> element 2 of list 0 is 3
> element 0 of list 1 is a
> element 1 of list 1 is b
> element 2 of list 1 is c

MatzLisp (Ruby):

[[1,2,3],[:a,:b,:c]].each_with_index{|array,i|
array.each_with_index{|item,j|
puts "Element #{j} of array #{i} is #{item}"}}

Element 0 of array 0 is 1
Element 1 of array 0 is 2
Element 2 of array 0 is 3
Element 0 of array 1 is a
Element 1 of array 1 is b
Element 2 of array 1 is c

--
[A]n unholy alliance of leftists, capitalists, and Zionist supremacists has
schemed to promote immigration and miscegenation with the deliberate aim of
breeding us out of existence in our own homelands.... [T]he real aim stays the
same: the biggest genocide in human history.... --- Nick Griffin
(https://www.youtube.com/watch?v=K...)