Michael Glass wrote:
>
> If perversity is not your bag, you can use the IPL routine
> IndexPDCO from the pdco module.
>
> IndexPDCO{e1, e2} produces the e2-th terms from e1. Thus:
>
> write(IndexPDCO{"a" | "b" | "c" | "d" | "e", 3})
>
> On the other hand, if perversity *is* your bag (growing up is
> still on my task list), Clint Jeffery's suggestions are truly
> noteworthy.
Grow up? What on earth for?
How about (based on a suggestion by Steve Hunter)?:
procedure Nth(L)
n := @L[2] | 1 # default to first
return 1( |@L[1], *L[1]=n )
end
Example call:
write( Nth{"a"|"b"|"c"|"d"|"e", 3} )
Not as general as IndexPDCO (where e2 can be a generator
producing monotonically increasing positions), but pretty
preverse...
--
Steve Wampler- SOLIS Project, National Solar Observatory
[EMAIL PROTECTED]
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group