William James
1/16/2016 8:47:00 AM
WJ wrote:
> G. Garza wrote:
>
> > > * (with-collectors (foo)
> > > (loop for pos upfrom 1
> > > for l in '((a b c) (one two three) (you and me) (girl))
> > > do (collect pos :into foo)
> > > do (loop for sym in l
> > > do (collect pos :into foo))
> > > finally (return foo)))
> > > (1 A B C 2 ONE TWO THREE 3 YOU AND ME 4 GIRL)
> >
> > ;;; Or....
> >
> > * (loop for pos upfrom 1
> > for l in '((a b c) (one two three) (you and me) (girl))
> > collect pos
> > append l)
> > (1 A B C 2 ONE TWO THREE 3 YOU AND ME 4 GIRL)
MatzLisp (Ruby):
[[:a,:b,:c],[:one,:two,:three],[:you,:and,:me],[:girl]].each_with_index.
flat_map{|xs,i| [i+1, *xs]}
===>
[1, :a, :b, :c, 2, :one, :two, :three, 3, :you, :and, :me, 4, :girl]
--
Government is not reason, it is not eloquence, it is force; like fire, a
troublesome servant and a fearful master. Never for a moment should it be left
to irresponsible action. --- George Washington, speech of January 7, 1790
Use this [sword] for me, if I rule well; if not, against me. --- Trajan