- The proto is &, not \&.
True. I keep messing this one up.
- x->() is shorter than &{x}().
- y while x is shorter than while (x) { y }.
- || is shorter than or .
- The label is not needed in the second snippet.
Yep. I thought of the case when you need lots of while loops, so the size of the definition doesn't really matter, only the way you use them.
- {x;redo} is shorter than x while 1.
Doesn't help here anymore I guess, because we have nonalnums around while.
- &{x} is even shorter if you don't care about @_.
Yes, but that doesn't really help because you don't get the @_ of the loop context, only the @_ passed to w or l.
While we're there, &{+pop} is even shorter than &{$_[0]} in the defn of l, and pop is shorter than $_[0] in w.
- Proto not needed for w in second snippet.
It puts the condition in scalar context, like while does, so it might save some characters in the loops.
In reply to Re^3: Golf Question - Shortest way to write while inside while
by ambrus
in thread Golf Question - Shortest way to write while inside while
by o0lit3
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |