NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
unfoldr (Score:1)
unfoldr { $_ ? ($_, $_ - 1) : () } 10;10,9,8,7,6,5,4,3,2,1which allows to pass arbitrary values to the callback .
Re:unfoldr (Score:1)
Btw, no, your point about alias vs copy is mistaken. The
inducefunction above takes a copy of the value and then aliases$_to that copy, so you are guaranteed to be able to modify the value, although if you want to preserve its last value past the unfolding, you want to arrange for that yourself.Reply to This
Parent