tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: (b)make: selecting every other element from a list

> Is there a sane way of, in a Makefile, selecting every other (i.e.
> either even or odd, I don't care) member from a list?  I'm aware of
> bmake's nice feature of iterating on tuples, but I need to select a
> unique subset of those list members.

Is there some reason for not doing that using iteration?

flip := on
newl :=
.for x in $l
.if "$flip" = "on"
newl := $(newl) $x
flip := off
flip := on

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index