Hi Meikel,

What I want to accomplish is to have the function 'fill the gap' if
not enough padding is supplied.

With the standard 'partition' function this does not work, as it only
adds as much padding as provided:

(partition 3 3 ["a"] [1 2 3 4 5 6 7 8 9 10])
;; ((1 2 3) (4 5 6) (7 8 9) (10 "a"))

I thought my implementation would solve this problem, but
unfortunately there is some bug in the code I haven't been able to
find.

Stefan


On Nov 23, 3:05 pm, Meikel Brandmeyer <[email protected]> wrote:
> Hi,
>
> while not having looked at your code, partition does what you want:
>
> user=> (partition 3 3 (repeat 3 "a") [1 2 3 4 5 6 7])
> ((1 2 3) (4 5 6) (7 "a" "a"))
> user=> (partition 3 3 (repeat 3 "a") [1 2 3 4 5 6 7 8])
> ((1 2 3) (4 5 6) (7 8 "a"))
> user=> (partition 3 3 (repeat 3 "a") [1 2 3 4 5 6 7 8 9])
> ((1 2 3) (4 5 6) (7 8 9))
> user=> (partition 3 3 (repeat 3 "a") [1 2 3 4 5 6 7 8 9 10])
> ((1 2 3) (4 5 6) (7 8 9) (10 "a" "a"))
>
> (Note: the 3 in repeat is not strictily necessary. 2 would be
> sufficient)
>
> Sincerely
> Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to