Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 rifling through the Monastery: (11)
As of 2014-09-19 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls