My other foray into trying to bring functional parity between positional parameters and sequence variables is "shift". I'd like a shift operator that operates on a sequence variable similar to how shift works on positional parameters. Something like perl's shift.
a=(foo bar spam)
now a is (bar spam)
Not sure if I should do this though. It is the equivilent of this not-too-ugly (but not too obvious either)
a=<[ $a[position() > 1] ]>
I am about to implement this (still may) when I realized that the proposed syntax is ambiguous for positional parameters !ReplyDelete
does that shift the variable $1 or shift $* by 1 ?
Only way to make sense of this is to not allow the syntax to shift positional parameters individually.
That is you can do
( shifts variable "a")
( shifts positional parameters $* by 1)
shift a 2
( shifts variable a by 2 )
but there is no syntax to shift $1 by 1 ...
shift 1 1
? Uglier then sin ?
Implemented in the next release (checked in now to svn)ReplyDelete
Now in v 0.0.2.5ReplyDelete