William James
5/8/2016 6:49:00 PM
WJ wrote:
> Jochen wrote:
>
> > > This ...
> > >
> > > CL-USER 1 > (loop for i for j in '(a b c) collect (cons i j))
> > > => ((0 . A) (1 . B) (2 . C))
> > >
> > > works perfectly on LispWorks, but not with SBCL
> > >
> > > => FOR is an unknown keyword in FOR or AS clause in LOOP.
> > >
> > > I found a way around it 'for i from 0' but am not sure if there is
> > > another smarter way to achieve this.
> >
> > I think the canonical way would be
> >
> > (loop for i upfrom 0
> > for j in '(a b c)
> > collect (cons i j))
>
> MatzLisp (Ruby):
>
> (:a .. :f).each_with_index.map{|c,i| [i,c]}
> ===>[[0, :a], [1, :b], [2, :c], [3, :d], [4, :e], [5, :f]]
OCaml:
List.mapi (fun i s -> i,s) ["alpha";"beta";"camel"];;
===>
[(0, "alpha"); (1, "beta"); (2, "camel")]
--
[T]he number of Jews killed there was 800,000,000.... [T]he Talmud makes it all
clear by informing us that the blood of the holocausted Jews ran to the sea in
a huge tidal wave that swept boulders in its path and was so deep that it
reached the nostrils of the Romans' horses.
nationalvanguard.org/2014/09/disillusioned-part-1/