Hi everyone,
I need some help for loading in large data from file. For instance,
I'm trying to load from a text file one line of 5000 double values
(separated by comma). Having 8 byte per double I would assume this to
fit into ~400MB of memory, at least when using a java double array
internall
Hi,
On Feb 22, 2010, at 1:43 AM, Meikel Brandmeyer wrote:
> Hi,
>
> On Feb 22, 12:18 am, Johnny Kwan wrote:
>> I'm really new to Clojure, but I'm under the impression that reduce would
>> be better than apply, since I assume that apply would reify the entire
>> sequence at once, whereas reduce
Hi,
On Feb 22, 2010, at 2:20 AM, Meikel Brandmeyer wrote:
> First some fixes:
>
> (defmacro #^{:private true} use-private
> [ns sym]
> `(def ~(with-meta sym {:private true}) @(ns-resolve '~ns '~sym)))
Awesome!
>> This, however, doesn't work. The first ~sym macroexpands to (quote sym),
>> w
Hi,
On Feb 22, 11:55 am, Johnny Kwan wrote:
> You're absolutely right. I use 'ns and 'sym because that's what all of the
> ns- functions use. I realize now that this is a macro, not a fn... :) I
> would like to make the fact that this is a macro transparent, so that it only
> accepts symb
Hi,
On Feb 22, 11:43 am, Johnny Kwan wrote:
> (time (reduce + (range 1 1000))) ; 4.5 secs on my Macbook Air
> (time (apply + (range 1 1000))) ; OutOfMemory error
Ah. It holds unto the head.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups
On Mon, Feb 22, 2010 at 11:43 AM, Johnny Kwan wrote:
> Whichever is faster depends on the size of the argument list
I see, thanks for clarifying. I'd then change my version to this since
I still like map with an anonymous function more than the
for-comprehension in this case.
defn h-mean [coll]
With 1.1 you could defalias a macro:
(defmacro foo)
(defalias bar foo)
With 1.2, the {:macro true} gets set to {:macro false}, so bar isn't a
macro. I spent a few minutes and couldn't find the change that caused
this.
I like the 1.1 behavior better. Anybody know the story on how this
cha
Yes, for the reasons stated.
First, and most important, clojure.core/distinct does not let me pass
in a keyfn, it's hard-coded.
Second, and as mentioned that's debatable, distinct could make more of
the filtering functionality it already has available to the caller,
for free.
On Feb 22, 11:53 am
It sounds to me that you want to use c.c.seq-utils/group-by, not
distinct.
On Feb 22, 7:22 am, Eugen Dueck wrote:
> Yes, for the reasons stated.
>
> First, and most important, clojure.core/distinct does not let me pass
> in a keyfn, it's hard-coded.
>
> Second, and as mentioned that's debatable,
The overhead of using a Clojure vector will be a little more than 2.5x on a
32-bit Sun JVM, because each Java object has an 8-byte overhead, and storing
references to those objects in a Clojure vector will use just over 4 bytes
per object. I'm not sure what the figure would be for a 64-bit JVM, bu
On Mon, Feb 22, 2010 at 5:30 AM, Johann Kraus wrote:
> However, when loading with read-lines from
> clojure.contrib.duck-streams and (map #(Double/parseDouble %) (.split
> line ",")) clojure requires several GB of RAM. Any suggestions for how
> to get this down to 400MB? And what would be the over
Hi all
add-classpath is marked as depreciated and does not work :(
(add-classpath "file:///jars/icu4j-4_2_1.jar")
Context classloader is not a DynamicClassLoader
[Thrown class java.lang.IllegalAccessError]
I don't want to restart jvm anytime I need a new jar.
Any workaround or replacement?
Hi,
On Feb 22, 2010, at 9:39 AM, David Nolen wrote:
You also might want to pick a different strategy for parsing the
string instead of splitting the string immediately into 5000
parts.
Along those lines, just use a regexp sequence.
Thanks,
Johnny
--
You received this message because
Hi,
On Feb 22, 11:30 am, Johann Kraus wrote:
> However, when loading with read-lines from
> clojure.contrib.duck-streams and (map #(Double/parseDouble %) (.split
> line ",")) clojure requires several GB of RAM.
In this case (as your numbers are delimited with ",") read-lines will
read just one g
For any functional programmers in or around Atlanta, GA,
The Atlanta Functional Programming Users Group is having its first Meeting!
Although the talk at this meeting will be about Haskell, we welcome
users of all functional programming languages and would love to have
Clojure users represented i
group-by does not filter, in contrast to distinct.
And I'm really only interested in one of the values considered equal
according to my keyfn. So if I sed group-by, I'd have to wrap it with
a call to map or similar. This is certainly an option, but I'd rather
not create all the intermediate vector
Coffee sounds great.
I'm from the suburbs, but I work downtown.
Maybe even a lunch would be feasible.
Not to pollute the Clojure group, I set up a temporary blog for us :
http://mcug.blogspot.com/
On Feb 21, 11:20 pm, Dan wrote:
> Should we go for a coffee to meet each other or something?
--
On Mon, Feb 22, 2010 at 11:20 AM, Lukas Lehner wrote:
> I don't want to restart jvm anytime I need a new jar.
> Any workaround or replacement?
>
This is one of the real downsides of the JVM. But it does beg the question,
why do you need to add jars constantly to your REPL?
add-classpath was neve
I've accepted the invitation to the Blog. Still, I don't think it
could replace a discussion group or mailing list. I wonder what means
other groups or using to coordinate their meeting?
On Feb 22, 12:09 pm, Jeff Heon wrote:
> Coffee sounds great.
>
> I'm from the suburbs, but I work downtown.
>
On 21 February 2010 16:49, Jack Fang wrote:
> So I can guess that, If you use deref, there can be multipule
> transcation running at once. But sometimes transcation must be rerun.
> If you use ensure, only one transcation is run. Others are blocked.
> Is it true?
Those which try to modify the ref
On 21 February 2010 20:58, Michael Wood wrote:
> Ah yes, that makes more sense :)
Yes, the first version I've posted was written precisely so as to
obscure my point. :-)
>> I'm using a newer commit (49a7d6b8e14050a45df5332e768ba6647752215d),
>> but this shouldn't make any difference.
>
> No, I o
The Haskell approach is to have two functions, nub and nubBy, which
perform the task of distinct and the task of distinct with a
user-provided keyfn, respectively. I'd love to see a distinct-by in
core or contrib. (Mostly for completeness, it's easy enough to
write...)
As for the extra set argumen
What does distinct-by return in case of a collision?
(keys (group-by...))
(map first (vals (group-by ...)))
(map other-fn (vals (group-by ...)))
You're still better off w/ group-by, and manipulating the resulting
map appropriately.
Sean
On Feb 22, 1:15 pm, Michał Marczyk wrote:
> The Haskell
On 22 February 2010 19:25, Sean Devlin wrote:
> What does distinct-by return in case of a collision?
I'm not sure what you mean by that. distinct-by would do precisely
what distinct does, only instead of comparing the items of the
argument collection themselves, it would compare values of (keyfn
My apologies for misrepresenting Haskell's nubBy:
On 22 February 2010 19:15, Michał Marczyk wrote:
> The Haskell approach is to have two functions, nub and nubBy, which
> perform the task of distinct and the task of distinct with a
> user-provided keyfn, respectively.
Actually nubBy takes a bina
PS. The code for both functions is lifted straight from clojure.core's distinct.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be p
Generally when you have a "*-by" fn, you return the a sequence of
original values, not the mapped values (e.g. sort-by)
However, in the case you suggest, you really should just be using map
& distinct, and not creating your own fn. Using the built ins as much
as possible is more idiomatic Clojure
Hi, This is a problem I was working on this morning (with the help of
chouser, thank you!), and ended up with a 'with-private-fns' macro that
works like this:
(with-private-fns [org.foo.bar [fn1 fn2]]
(deftest test-fn1..)
(deftest test-fn2..))
I'm a Clojure greenhorn, but I like this approach
Object-oriented design has been frequently sourced as becoming
standard for simulations. Even on the clojure website, it states,
"[Object-oriented design is ] Born of simulation, now used for
everything, even when inappropriate". I've also heard GUIs are more
easily developed using object orienta
(Moderators ... resending this, sorry if it's already in the queue)
Hi,
I'd like to be able to use the *are* testing macro like this:
(are [input]
(= input (myfun input))
*my-input-data*)
But this doesn't work; the args are expected to be listed on-by-one,
not in a list:
(defmacro are
[ar
On 22 February 2010 19:59, Sean Devlin wrote:
> Generally when you have a "*-by" fn, you return the a sequence of
> original values, not the mapped values (e.g. sort-by)
Which is precisely what both versions of distinct-by are doing. They
return a sequence of values taken from the original collec
Okay, your longer post makes more sense.
Then is the seq (1 :a a) guaranteed? How do I know that I won't get
(2 :b b), (1 :b c), etc? What if I want a specific combination
instead? I've had to actually code this specific problem, and I found
that using group-by & some secondary mapping operatio
Has anyone successfully gotten clojure to play well with eclipse in
developing java code?
By this I mean that the clojure code automatically compiles to class
files the same way as java files in eclipse do, and the whole thing
can then be packaged into a jar and made into a web start application?
It will be difficult to find the review you are looking for, because
(IMO) Clojure is gradually carving out its own ecological niche. For
example, is Stuart Sierra's recent draft of test2 (http://paste.lisp.org/display/95188#1
) FP, or is it OO? You could make the case that this style of
pr
On 22 February 2010 15:43, Stuart Halloway wrote:
> With 1.1 you could defalias a macro:
>
> (defmacro foo)
> (defalias bar foo)
>
> With 1.2, the {:macro true} gets set to {:macro false}, so bar isn't a
> macro. I spent a few minutes and couldn't find the change that caused this.
>
> I like the 1
Hi,
On Mon, Feb 22, 2010 at 05:20:07PM +0100, Lukas Lehner wrote:
> add-classpath is marked as depreciated and does not work :(
>
> (add-classpath "file:///jars/icu4j-4_2_1.jar")
>
> Context classloader is not a DynamicClassLoader
> [Thrown class java.lang.IllegalAccessError]
>
> I don't wan
Hello,
2010/2/22 Robert McIntyre :
> Has anyone successfully gotten clojure to play well with eclipse in
> developing java code?
>
> By this I mean that the clojure code automatically compiles to class
> files the same way as java files in eclipse do, and the whole thing
> can then be packaged int
I don't mean to signal the end of this thread, but I just wanted to thank
you all for you replies.
I will update the draft (and add Colin and Mikel's infinite seq code as
well) possible in a day or two (no at home till then), and post the new code
before posting to Rosetta.
Cheers,
Aviad
On 22 F
On 22 February 2010 20:28, Sean Devlin wrote:
> Then is the seq (1 :a a) guaranteed? How do I know that I won't get
> (2 :b b), (1 :b c), etc? What if I want a specific combination
> instead? I've had to actually code this specific problem, and I found
> that using group-by & some secondary map
Hi,
On Mon, Feb 22, 2010 at 02:04:37PM -0500, Alan Dipert wrote:
> (defmacro with-private-fns [[ns fns] & tests]
> "Refers private fns from ns and runs tests in context."
> `(let ~(reduce #(conj %1 %2 `(ns-resolve '~ns '~%2)) [] fns)
> ~...@tests))
Without a deref around the ns-re
Excellent points.
+1 for orthogonality.
Sean
On Feb 22, 3:13 pm, Michał Marczyk wrote:
> On 22 February 2010 20:28, Sean Devlin wrote:
>
> > Then is the seq (1 :a a) guaranteed? How do I know that I won't get
> > (2 :b b), (1 :b c), etc? What if I want a specific combination
> > instead? I'
Hi
For that I need to run JVM again...
Imagine I am using one VM instance for more in parallel running programs
and updating them as they are running.
When I shutdown VM, I have to start and set up all of them again. (I
cannot get the desired state of environment so quickly)
L
On 2/22/201
Hi
There are some links on google for "java add classpath runtime"
Particularly
http://jimlife.wordpress.com/2007/12/19/java-adding-new-classpath-at-runtime/
and http://forums.sun.com/thread.jspa?threadID=300557
but haven't tried (not so skilled in java) and don't know how to turn
them into c
Nice git fu! With that help, here is a Clojure-only (no contrib.def)
sequence that shows the difference between 1.1 and 1.2:
;; all running on 1.2, DIFF noted in comments
(defmacro foo [])
-> #'user/foo
(meta (def bar (.getRoot #'foo)))
-> {:macro false, :ns #, :name bar, :file
"NO_SOURCE_P
hello,
I had the same problem.
I created ~/.swank-clojure directory, and downloaded there swank-
clojure-1.1.0.jar from http://repo.technomancy.us/. Now M-x slime
works.
On Feb 20, 11:40 am, Paul Tarvydas
wrote:
> > >When you perform the installation, you will see warnings related to the
> > >
Hi all,
Disclaimer: absolute beginner here, so probably missing something very
obvious.
I'm just wondering why certain forms, like let, natively allow for
multiple body/expression argument forms. That is, let seems to
natively allow for side effects.
Wouldn't it make sense to limit let to a sing
Hi,
On Mon, Feb 22, 2010 at 10:25:23PM +0100, Lukas Lehner wrote:
> For that I need to run JVM again...
Not for the unzipping approach… (at least for adding to the classpath,
however not for modifying existing things)
> Imagine I am using one VM instance for more in parallel running
> programs
On Mon, Feb 22, 2010 at 12:51 PM, Peter T wrote:
> Am just curious what the rationale is behind the implicit do.
ja, personally i find the implicit do's in Clojure or begin's in
Schemes to be kinda bad, sort of along the lines of what you say. i
feel like there's all this talk about how functiona
Hi Meikel, thank you as always for your help! This makes a lot of
sense. Am I correct in understanding that at some level there is a
separation of var and fn namespace? Or is the need for deref more just
a consequence of the way objects respond with their contents? Please forgive
my ignorance,
On Mon, Feb 22, 2010 at 3:51 PM, Peter T wrote:
> Hi all,
>
> Wouldn't it make sense to limit let to a single body/expression
> argument, and otherwise require the explicit use of do?
>
> I realize that'd be rather verbose, but it'd seem to also help make
> the presence of side effects more app
On Mon, Feb 22, 2010 at 4:54 PM, Raoul Duke wrote:
> On Mon, Feb 22, 2010 at 12:51 PM, Peter T wrote:
> > Am just curious what the rationale is behind the implicit do.
>
> ja, personally i find the implicit do's in Clojure or begin's in
> Schemes to be kinda bad, sort of along the lines of what
> I think pretty well covered here: http://clojure.org/special_forms.
thanks, i'll re-re-read :)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are modera
As most of you already probably know, there's a big rework of
ClojureQL's frontend. The development is now more focused on this
redesign and lots of great ideas have been found. Yet, it's always
good to get more inputs as this library will certainly become a common
tools for all Clojurians. The cod
Hi,
On Mon, Feb 22, 2010 at 05:07:33PM -0500, Alan Dipert wrote:
> Hi Meikel, thank you as always for your help!
You are welcome. :)
> This makes a lot of sense. Am I correct in understanding that at some
> level there is a separation of var and fn namespace? Or is the need
> for deref more just
I get it, thank you!
Alan
Excerpts from Meikel Brandmeyer's message of 2010-02-22 17:22:19 -0500:
> Hi,
>
> On Mon, Feb 22, 2010 at 05:07:33PM -0500, Alan Dipert wrote:
> > Hi Meikel, thank you as always for your help!
>
> You are welcome. :)
>
> > This makes a lot of sense. Am I correct in und
Okay, Google created:
http://groups.google.ca/group/montreal-clojure-user-group
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be p
I've been trying to pinpoint the source of the problem and I found
something pretty amazing:
Regular def:
user> (def foobar (.getRoot #'defalias))
#'user/foobar
user> (meta #'foobar)
{:ns #, :name foobar, :file "NO_SOURCE_FILE", :line 1}
def occuring as an argument to a function:
user> (println
Hi Tim,
On Feb 19, 3:17Â pm, Timothy Pratley wrote:
> (defn some-action [x] (println "FOO:" (:clojure.contrib.http.agent/result x)))
Thanks for the tip, when I looked at the http-agent code and I saw the
::result keyword I thought that meant it was private to the namespace
which meant I couldn't
Thank you brother. This did the trick for me.
On Feb 22, 2:39 pm, ajazz wrote:
> hello,
> I had the same problem.
>
> I created ~/.swank-clojure directory, and downloaded there swank-
> clojure-1.1.0.jar fromhttp://repo.technomancy.us/. Now M-x slime
> works.
>
> On Feb 20, 11:40 am, Paul Tarvyda
Hi phil. Thanks for your help with this. This step of downloading the
jars into .swank-clojure is what never happened and why it never
worked through elpa. Downloading the swank-clojure jar manually fixed
the problem.
I'm not sure if you manage the swank-clojure install via elpa but
please let me
On Feb 22, 8:51 pm, Peter T wrote:
> I'm just wondering why certain forms, like let, natively allow for
> multiple body/expression argument forms. That is, let seems to
> natively allow for side effects.
Well, firstly, limiting the body of let to one expression doesn't
prevent side-effects. Seco
61 matches
Mail list logo