Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!male!anywhere.EBay.Sun.COM!me From: me@anywhere.EBay.Sun.COM (Wayne Thompson - IR Workstation Support SE) Newsgroups: comp.lang.perl Subject: listolists.pl Message-ID: <5815@male.EBay.Sun.COM> Date: 22 Mar 91 17:40:39 GMT Sender: news@male.EBay.Sun.COM Lines: 75 I've sent this out before but it never showed up. If you've seen this before, send a note. If you're seeing this now, an ack would also be appreciated. Having trouble posting Wayne # This package implements list of lists functions. # Brandon S. Allbery (allbery@NCoast.ORG) developed the first two and # I filled in the rest. Wayne Thompson (me@Sun.COM) package listolists; $gensym = 'gensym00000000000'; sub main'pushlist # pushlist(*ARRAY,LIST) { local(*l1, @l2) = @_; local(*sym) = $gensym++; @sym = @l2; push(@l1, *sym); } sub main'poplist # poplist(*ARRAY) { local(*l1) = @_; local(*sym) = pop(@l1); @sym; } sub main'shiftlist { # shiftlist(*ARRAY) local(*l1) = @_; local(*sym) = shift(@l1); @sym; } sub main'unshiftlist { # unshiftlist(*ARRAY,LIST) local(*l1, @l2) = @_; local(*sym) = $gensym++; @sym = @l2; unshift(@l1, *sym); } sub main'setlist # setlist(*ARRAY,INDEX,LIST) { local(*l1, $index, @l2) = @_; local(*sym) = @l1[$index] || $gensym++; @sym = @l2; @l1[$index] = *sym; } sub main'getlist # getlist(*ARRAY,INDEX) { local(*l1, $index) = @_; local(*sym) = $l1[$index]; @sym; } sub main'splicelist # splicelist(*ARRAY,INDEX,OFFSET,LENGTH,LIST) { local(*l1, $index, $offset, $length, @l2) = @_; local(*sym) = @l1[$index] || $gensym++; @sym = @l2; splice (@l1, $offset, $length, *sym); } 1;