Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Rosetta code: Split an array into chunks

by stefan k (Curate)
on Sep 27, 2010 at 08:42 UTC ( #862165=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    (defn pm-chunk [data chsize]
      (apply str
    ...
                              (partition chsize chsize nil data))
                         (repeat \newline))))
    
  2. or download this
    user=> (print (pm-chunk  ["a" "bb" "c" "d" "e" "f" "g" "h"] 3))
    a bb c
    d e f
    g h
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://862165]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2019-08-17 21:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?






    Results (134 votes). Check out past polls.

    Notices?