William James
10/30/2015 3:11:00 PM
WJ wrote:
> Rob Warnock wrote:
>
> > > (loop for (a b . rest) in '((a b c d e) (f g h) (i j k l) (m n))
> > collect (list* a b :n-rest (length rest) :rest rest))
> >
> > ((A B :N-REST 3 :REST C D E)
> > (F G :N-REST 1 :REST H)
> > (I J :N-REST 2 :REST K L)
> > (M N :N-REST 0 :REST))
>
> Gauche Scheme:
>
> (use util.match)
> (map
> (match-lambda ((a b . rest) (cons* a b :n-rest (length rest) :rest rest)))
> '((a b c d e) (f g h) (i j k l) (m n)))
>
> ===>
> ((a b :n-rest 3 :rest c d e)
> (f g :n-rest 1 :rest h)
> (i j :n-rest 2 :rest k l)
> (m n :n-rest 0 :rest))
MatzLisp (Ruby):
[[:a,:b,:c,:d,:e],[:f,:g,:h],[:i,:j,:k,:l],[:m,:n]].map{|a,b,*x|
[a,b,:n_rest, x.size, :rest, *x]}
[[:a, :b, :n_rest, 3, :rest, :c, :d, :e],
[:f, :g, :n_rest, 1, :rest, :h],
[:i, :j, :n_rest, 2, :rest, :k, :l],
[:m, :n, :n_rest, 0, :rest]]
--
Blacks are an estimated 39 times more likely to commit a violent crime
against a white than vice versa, and 136 times more likely to commit robbery.
www.colorofcrime.com/2005/10/the-color-of-crime-2005/