Could someone else also try the sample code I included to see if they
also experience the same ~10x slowdown for (count (filter ...)) in 1.3
Alpha 2?
On Oct 28, 12:34 pm, Btsai benny.t...@gmail.com wrote:
I have some code that counts the elements in a list that map to true
in a lookup table
Awesome, thank you :)
On Oct 29, 2:29 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
Rich has fixed this on
master:http://github.com/clojure/clojure/commit/e354b01133e7cff8dc0d0eb9e90c...
Thanks for the report!
Stu
I have some code that counts the elements in a list that map
I have some code that counts the elements in a list that map to true
in a lookup table, looking something like this:
(def lookup-table {1 true, 2 false})
(def elements (range 100))
(count (filter lookup-table elements))
On my machine, with server mode enabled, the count + filter got ~10
.
Zack Kim and I are working to have clojuredocs pull data from the
autodoc system and, at that point, I assume that he'll add deprecation
info over there as well.
Sorry for any confusion! Clojure's still a fast moving target.
Tom
On Oct 26, 12:48 pm, Btsai benny.t...@gmail.com wrote
: NAME-OF-THE-LIBRARY
version: 1.3.0-alpha2
Or in Leiningen: [org.clojure.contrib/NAME-OF-THE-LIBRARY 1.3.0-
alpha2]
-S
On Oct 26, 10:37 pm, Btsai benny.t...@gmail.com wrote:
Is there still a complete jar somewhere that has all the modules? If
so, I can't seem to find
Is it ok if the index starts at 0?
(use '[clojure.contrib.seq :only (indexed)])
(defn get-min-and-index [coll]
(apply min-key #(second (second %)) (indexed coll)))
user= (get-min-and-index [[22 5] [56 8] [99 3] [43 76]])
[2 [99 3]]
On Oct 26, 7:54 pm, Glen Rubin rubing...@gmail.com wrote:
I
Is there still a complete jar somewhere that has all the modules? If
so, I can't seem to find it. Or is that a thing of the past now?
On Oct 26, 6:03 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:
blah
--
You received this message because you are subscribed to the Google
Groups Clojure
I don't think it's a mistake or accident that spit exists in
clojure.core. In 1.2, duck-streams became deprecated and functions
such as spit were incorporated into clojure.core:
http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/spit
I think the indexing in all-combs may be off, causing it to miss
certain combinations/substrings.
user= (all-combs abc)
(a ab)
I used this instead:
(defn substrings [s]
(let [length (count s)]
(for [i (range length)
j (range (inc i) (inc length))]
(subs s i j
user=
Some more data points on 1.3 alpha 1 performance:
bit operations appear to be much faster on hinted args. For example,
(defn unhinted-shift [n] (bit-shift-left n 1))
(defn ^:static hinted-shift [^long n] (bit-shift-left n 1))
user= (time (doseq [x (range 10)] (unhinted-shift x)))
Hi Mark,
I tested the change to expt-int. Unfortunately, still no performance
gain.
I'm afraid I don't have a solid enough grasp of Clojure to know what
tweaks are needed to get performance fast again. Do you think you'll
have time to play with 1.3 soon?
On Sep 27, 1:00 am, Mark Engelberg
I found that even without patching, most functions in
clojure.contrib.math already correctly handle big nums in 1.3:
Handles big nums in 1.3?
absYes
ceil Yes
exact-integer-sqrt No
expt No
floor Yes
gcdYes
lcm
Thanks Eric :) Have you considered submitting that change as a patch?
On Sep 24, 5:35 pm, Eric Lavigne lavigne.e...@gmail.com wrote:
I think I read somewhere that max-key applies f more times than is
necessary, so should not be pass any f that takes significant time to
compute.
Yes,
I went through the rest of my Project Euler code. In addition to
even?, there are some functions in clojure.contrib that are also much
slower in 1.3 Alpha 1.
clojure.contrib.math - expt
(Clojure 1.2)
user= (time (doseq [x (range 10)] (expt x 2)))
Elapsed time: 119.417971 msecs
Awesome, thanks :)
On Sep 25, 8:44 pm, Mark Engelberg mark.engelb...@gmail.com wrote:
http://code.google.com/p/clojure/issues/detail?id=95
I just looked over this code. You can speed it up even more by
manually encoding the loop, rather than using reduce.
(defn faster-max-key
([k x] x)
I haven't tried 1.3 yet, but I'd recommend downloading a copy of
clojure.contrib.math locally and replace any instances of +, -, *,
inc, dec with +', -', *', inc', dec'. This should at least make the
functions produce the correct results. I'd be curious to know whether
performance continues
After updating from Clojure 1.2 to Clojure 1.3 Alpha 1, I noticed that
one of my Project Euler solutions became dramatically slower. The
solution was for Problem 14, finding the number less than N that
produces the longest Collatz sequence.
For N = 100,000, the time required to find the answer
msecs
Clojure 1.3 Alpha 1 = 190769.86 msecs
On Sep 24, 10:41 am, Btsai benny.t...@gmail.com wrote:
After updating from Clojure 1.2 to Clojure 1.3 Alpha 1, I noticed that
one of my Project Euler solutions became dramatically slower. The
solution was for Problem 14, finding the number less than N
David, Nicolas, thank you for finding the culprit so quickly :)
What profiling technique/tool did you use? I have some other code
that is also much slower in 1.3, and thought I'd take a crack at
finding the culprit myself before spamming the list again.
On Sep 24, 11:26 am, Nicolas Oury
Thank you David. Time for me to dig in!
On Sep 24, 3:36 pm, David Nolen dnolen.li...@gmail.com wrote:
On Fri, Sep 24, 2010 at 5:25 PM, Btsai benny.t...@gmail.com wrote:
David, Nicolas, thank you for finding the culprit so quickly :)
What profiling technique/tool did you use? I have some
I second the motion. Just moved to Edmonton, and have been looking
around for fellow Clojurians. I've created an Edmonton meetup (I
think), and hopefully some kindred souls will turn up :)
On Sep 20, 9:33 am, Andrew Gwozdziewycz apg...@gmail.com wrote:
Hey All,
I know there are certainly a
My poor brain can't handle nested calls to update-in, so this is what
I came up with:
(defn add-meetings [data k meetings]
(cond
(nil? (data k)) (assoc data k {:title title :meetings meetings})
:else (update-in data [k :meetings] concat meetings)))
On Sep 16, 8:53 am, Laurent PETIT
be the default
value, imagine you want to modify a path [:a 2] :
(update-in {} [:a] (fnil update-in [:foo :bar :baz]) [2] str) = {:a [:foo
:bar :baz]}
2010/9/16 Btsai benny.t...@gmail.com
My poor brain can't handle nested calls to update-in, so this is what
I came up with:
(defn
...@mit.edu wrote:
That is very elegant but has the exact same problem in that the macro
must be called on a literal vector of keywords.
--Robert McIntyre
On Fri, Sep 10, 2010 at 5:41 PM, Btsai benny.t...@gmail.com wrote:
This is probably not the prettiest way to do it, but I think it gets
Btsai, thank you for your offer for help.
As I said before I *could* use literals but it wouldn't be convenient.
I have a big structure which contains information about types (they
are types of domain-specific objects). I would like to extract the
methods I need from this structure and define them
This is probably not the prettiest way to do it, but I think it gets
the job done:
(defn make-sym [keyword]
(- keyword name (str prefix-) symbol))
(defn make-fn [keyword]
(let [n (gensym)]
(list 'defn (make-sym keyword) [n] (list '= n keyword
(defmacro make-fns [keywords]
`(do
How are you grabbing the sources? I'm also running under Windows, and
get the source from github via msysgit, which handles the crlf vs. cr
issue nicely.
On Aug 27, 8:07 am, gary ng garyng2...@gmail.com wrote:
I need to exclude/modify a few test when running under windows, due to
the crlf vs
Ah, so this is the context for your previous thread about multiplying
lists. Re-using some of the code from that thread:
(def target [[1 2 3 4] [2 3 4 5]])
(def signal [[[1 2 3 4] [2 3 4 5] [3 4 5 6]] [[2 3 4 5] [3 4 5 6] [4 5
6 7]]])
(defn correlate [target signal]
(let [mult-lists (fn [x
I believe duck-streams is deprecated since clojure 1.2. You may want
to consider bringing back f-to-seq, which can be simplified slightly
using reader from clojure.java.io:
(ns clojure.example.anagrams
(:use [clojure.java.io :only (reader)])
(:gen-class))
(defn f-to-seq [file]
(with-open
Congratulations!
Just as a heads-up, the download link for Clojure Contrib on
http://clojure.org/downloads is currently broken. It's pointing to:
http://github.com/downloads/clojure/clojure/clojure-contrib-1.2.0.zip
.. when I'm guessing it should be:
Yet another one for Emacs users that don't use paredit:
I have Paren Match Highlighting enabled and set to highlight the
entire expression within matching parens (the highlighting kicks in
when the cursor is before the opening paren or after the closing
paren):
(show-paren-mode 1)
(setq
This should work:
(defn mult-list-by-lists [a b]
(let [mult-lists (fn [x y] (map * x y))]
(map #(mult-lists a %) b)))
On Aug 19, 5:56 pm, Glen Rubin rubing...@gmail.com wrote:
I want to multiply a list of n items by h lists of n items, so that
for example if i have list 'a' and 'b'
No worries :)
On Aug 16, 12:55 pm, Timothy Washington twash...@gmail.com wrote:
Ahh, my bad.
Cheers
Tim
On Sun, Aug 15, 2010 at 8:40 PM, Btsai benny.t...@gmail.com wrote:
I think the mismatch is because page you looked at is for
clojure.string, not clojure-contrib.string
Continuing this train of thought...
1. The declare macro may be handy for declaring multiple names at
once.
2. Maybe one could use the functions in clojure.repl or clojure-
contrib.ns-utils to write something that automatically forward
declares everything needed?
On Aug 13, 10:49 pm, Tim Daly
The following worked for me:
(ns your-namespace
(:require (clojure.contrib io)))
(See: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ns)
This also works:
(ns your-namespace
(:require [clojure.contrib.io]))
On Aug 11, 2:46 am, Meikel Brandmeyer m...@kotka.de wrote:
Hmmm. Actually, as Meikel noted, this should be fine, and it does
indeed work for me:
(ns your-namespace
(:require clojure.contrib.io))
The only time I got the Don't know how to create ISeq from:
clojure.lang.Symbol exception is when I erroneously copy-pasted and
tried to evaluate this:
(ns
The jar can be located in the target sub-directory.
On Aug 1, 2:37 am, Mark Engelberg mark.engelb...@gmail.com wrote:
Meant to say, ...zip doesn't have a compiled jar...
On Sun, Aug 1, 2010 at 1:36 AM, Mark Engelberg
mark.engelb...@gmail.comwrote:
On Fri, Jul 30, 2010 at 8:00 AM, Stuart
Thank you Tom :)
On Jul 18, 12:10 pm, Tom Faulhaber tomfaulha...@gmail.com wrote:
The official doc for clojure and clojure-contrib have moved as well.
They are now at:
http://clojure.github.com/clojure/
and
http://clojure.github.com/clojure-contrib/
I have not got them completely
Hi Clojurians,
The recent 1.2 beta release is the first time I played with 1.2. When
reading the release notes, I saw a number of new namespaces. I was
able to find most of them (clojure.java.io, etc.) on the API site
(http://richhickey.github.com/clojure/). However, I could not find
the
show up just fine there, which is why I'm confounded
why clojure.string is not there.
On Jul 17, 8:57 am, Adrian Cuthbertson adrian.cuthbert...@gmail.com
wrote:
Hi Benny,
The 1.2 release source site has moved tohttp://github.com/clojure/
-Regards, Adrian
On Sat, Jul 17, 2010 at 8:00 AM, Btsai
Congrats to Clojure on hitting this fantastic milestone :)
Question: the release notes mentions a new clojure.string namespace.
But I've had no luck finding it in the online API at
http://richhickey.github.com/clojure/. Am I missing something?
On Jul 14, 9:03 am, Stuart Halloway
41 matches
Mail list logo