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

Re: Rosetta code: Split an array into chunks

by chb (Deacon)
on Sep 27, 2010 at 07:42 UTC ( [id://862156]=note: print w/replies, xml ) Need Help??


in reply to Rosetta code: Split an array into chunks

Common Lisp anyone ?
(defun chunky (strings &optional (chunksize 3)) (format nil "~{~A~%~}" (loop while strings collect (reduce #'(lambda (a b) (concatenate 'string a " " b)) (loop repeat chunksize append (when strings (list (pop strings)))))))) (chunky '("a" "bb" "c" "d" "e" "f" "g" "h")) "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://862156]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found