Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Non-destructive array processing

by runrig (Abbot)
on Jan 20, 2003 at 23:34 UTC ( #228523=note: print w/replies, xml ) Need Help??

in reply to Non-destructive array processing

Nice trick. I like it as a sort of answer to LISP-like linked lists without having to resort to 2-element array references:
my @array = qw(a b c d); my $r = sub { \@_ }->(@array); my $a = cdr($r); print "arr: @array\n"; print "a: @$a\n"; print "r: @$r\n"; $array[2]="hello"; print "arr: @array\n"; print "a: @$a\n"; print "r: @$r\n"; sub cdr { my $r = shift; my $a = sub { \@_ }->(@$r); shift @$a; $a; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://228523]
[1nickt]: Discipulus too easy!
[1nickt]: "The sixth sheik's sixth sheep's sick" (if you are after 'sh' tongue twisters)
[Discipulus]: ok try it in Eatalian ;=)
[Eily]: Discipulus I don't suppose you can do the same for me can you ? :P
[Discipulus]: Eily tongue twister or votes? ;=)
[Eily]: Discipulus turn me into a Bishop
Discipulus abracadabra.. Eily tranformed into a.. shop for bisexual peoples..
[LanX]: Eily don't be sad ... you are the Bishop of our hearts.
[marto]: 1nickt, I just said that in a Sean Connery accent
[LanX]: Discipulus++ # Bi-Shop

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2017-09-26 12:07 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (294 votes). Check out past polls.