Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Rosetta code: Split an array into chunks

by stefan k (Curate)
on Sep 27, 2010 at 08:42 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://862165]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found