2015-02-17 20:26 GMT+01:00 Timothy Baldridge <[email protected]>:
> Tweak as needed:
>
> (keep-indexed
> (fn [i v]
> (if (= 0 (mod i 5))
> nil
> v))
> (range 30))
>
I made the following:
(defn indexed-sieve [index this-list]
(keep-indexed
(fn [i v]
(if (= 0 (mod (inc i) index))
nil
v))
this-list))
The first element should not be filtered (counting from 1) and because I
will use it more often I created a function.
> On Tue, Feb 17, 2015 at 12:21 PM, Cecil Westerhof <[email protected]>
> wrote:
>
>> What is the best way to remove all elements which position (counting from
>> 1) is a multiply of five out of a list?
>>
>> So the list:
>> (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21)
>> becomes:
>> (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21)
>>
>
--
Cecil Westerhof
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.