Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

reduce like iterators

by LanX (Saint)
on Jan 03, 2011 at 17:57 UTC ( [id://880228]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        ?- compress([a,a,a,a,b,c,c,a,a,d,e,e,e,e],X).
        X = [a,b,c,a,d,e]
    
  2. or download this
      DB<1>  my $p; print  grep { $p = $_  if  $_ ne $p }  (a,a,a,a,b,c,c,
    +a,a,d,e,e,e,e);
    abcade
    
  3. or download this
      DB<2>  my $p; print map { $p ne $_ ? $p = $_ : () } (a,a,a,a,b,c,c,a
    +,a,d,e,e,e,e)
    abcade
    
  4. or download this
     DB<3> use feature "state"; print map { state $p; $p ne $_ ? $p = $_ :
    + () } (a,a,a,a,b,c,c,a,a,d,e,e,e,e)
    abcade
    
  5. or download this
      print  grep {  $_ ne $^PRE }  (a,a,a,a,b,c,c,a,a,d,e,e,e,e);
    abcade
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://880228]
Approved by ELISHEVA
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found