Ah ok. Got it.
On Wed, Feb 18, 2015 at 9:13 AM, Fluid Dynamics wrote:
> On Tuesday, February 17, 2015 at 10:24:29 PM UTC-5, Udayakumar Rayala
> wrote:
>>
>> Then probably (apply concat) is better than (mapcat identity) isnt it?
>>
>> What is (cons ::sentinel)? Why do you need it here?
>>
>
> It'
On Tuesday, February 17, 2015 at 10:24:29 PM UTC-5, Udayakumar Rayala wrote:
>
> Then probably (apply concat) is better than (mapcat identity) isnt it?
>
> What is (cons ::sentinel)? Why do you need it here?
>
It'll drop the wrong elements otherwise:
=> (->> (range 1 22)
(partition 5 5 nil)
Then probably (apply concat) is better than (mapcat identity) isnt it?
What is (cons ::sentinel)? Why do you need it here?
On Wed, Feb 18, 2015 at 5:58 AM, Fluid Dynamics wrote:
> On Tuesday, February 17, 2015 at 6:47:59 PM UTC-5, Ben wrote:
>>
>> why not (mapcat next)?
>>
>
> Yeah, that should
On Tuesday, February 17, 2015 at 6:47:59 PM UTC-5, Ben wrote:
>
> why not (mapcat next)?
>
Yeah, that should work too, though conceptually trimming each part and then
reflattening the partition are two separate steps of the computation. :)
> The correct answer, obviously, is
>
> (->> s
> (co
why not (mapcat next)?
On Tue, Feb 17, 2015 at 3:45 PM, Fluid Dynamics wrote:
> On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof 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:
On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof 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
Sounds almost like a mirror image of `clojure.core/take-nth`, so something
like this is kind of fun:
(defn drop-nth [n coll]
(lazy-seq
(when-let [s (seq coll)]
(concat (take (dec n) s) (drop-nth n (drop n s))
On Tuesday, February 17, 2015 at 1:21:20 PM UTC-6, Cecil Westerhof
+1
And don't forget Eastwood as well :).
On a more serious note, I found
http://blog.mattgauger.com/blog/2014/09/15/clojure-code-quality-tools/ has
some other great tips related to this.
On 17 Feb 2015 20:51, "Timothy Baldridge" wrote:
> Clearly the answer is a program that runs every snippet p
Clearly the answer is a program that runs every snippet posted to this
mailing list through kibit (https://github.com/jonase/kibit).
On Tue, Feb 17, 2015 at 1:49 PM, Colin Yates wrote:
> Style police would point out zero? and when-not :).
> On 17 Feb 2015 20:40, "Cecil Westerhof" wrote:
>
>> 20
Style police would point out zero? and when-not :).
On 17 Feb 2015 20:40, "Cecil Westerhof" wrote:
> 2015-02-17 20:26 GMT+01:00 Timothy Baldridge :
>
>> Tweak as needed:
>>
>> (keep-indexed
>> (fn [i v]
>> (if (= 0 (mod i 5))
>> nil
>>
2015-02-17 20:26 GMT+01:00 Timothy Baldridge :
> 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]
Tweak as needed:
(keep-indexed
(fn [i v]
(if (= 0 (mod i 5))
nil
v))
(range 30))
On Tue, Feb 17, 2015 at 12:21 PM, Cecil Westerhof
wrote:
> What is the best way to remove all elements which position (counting from
>
True, that works, but he wants to remove based on element position, not
element value.
Timothy
On Tue, Feb 17, 2015 at 12:28 PM, Ivan L wrote:
> this works
>
> => (filter #(not= (mod % 5) 0) (range 22))
> (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21)
>
>
> On Tuesday, February 17, 2015 at 2:21:2
this works
=> (filter #(not= (mod % 5) 0) (range 22))
(1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21)
On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof wrote:
>
> What is the best way to remove all elements which position (counting from
> 1) is a multiply of five out of a list?
>
14 matches
Mail list logo