I wouldn't say it has *nothing* to do with dotimes. If dotimes were
lazy rather than eager, then his form would do nothing despite the
eagerness of into, because into is not being called:
(for [i (range 100)]
(into [] (some-expensive-calc)))
On Oct 14, 3:34 pm, Meikel Brandmeyer wrote:
> H
Hi,
Am 14.10.2010 um 23:07 schrieb Henk:
> Does dotimes force evaluation?,
At a different level. (dotimes [n 1] (for ...)) does evaluate the for form.
But it returns a seq which is never realised. So you do effectively … nothing.
(dotimes [n 1] (into [] (for ...))) as in your example d
On Thu, Oct 14, 2010 at 4:54 PM, Henk wrote:
> Thanx!,
>
> That is exactly what I was looking for!,
>
> Being a clojure newbie and a non-native speaker it is hard to find
> the correct function among many in clojure core API :-)
> If only the documentation would provide simple examples like you
>
Does dotimes force evaluation?,
if so, then the Clojure version is about twice as fast for me...
which would be nice to finally find a good dynamic programming
language that is also
nice and fast :-)
the code I tested is this:
(def HHQ [{:id 1956, :firstname "Piet", :lastname
"Puk", :programming
Thanx!,
That is exactly what I was looking for!,
Being a clojure newbie and a non-native speaker it is hard to find
the correct function among many in clojure core API :-)
If only the documentation would provide simple examples like you
provided...
On 14 okt, 18:20, liebke wrote:
> Here's one a
On Oct 14, 11:54 am, Henk wrote:
> (I did some small benchmarks on this), while the list comprehension
> itself is much faster than python...
Not an answer to your question, but: depending on what you mean by
"much faster", there is a good chance that you measured the clojure
for expression doing
Here's one approach:
(into {} [[:a 1] [:b 2] [:c 3]])
=> {:a 1, :b 2, :c 3}
On Oct 14, 11:54 am, Henk wrote:
> Hi All,
>
> In Python I was used to be able to easily create dictionaries from
> lists of key value 'pairs' (tuples or list), e.g. like this:
>
> dict([(10, 20), (30, 40)]) #using the
Hi All,
In Python I was used to be able to easily create dictionaries from
lists of key value 'pairs' (tuples or list), e.g. like this:
dict([(10, 20), (30, 40)]) #using the dict constructor
=>
{10:20, 30:40}
What would be the equivalent in Clojure?, e.g. the normal Clojure hash-
map function ta