Re: Read in a big file and get GC limit/outofmemory error.

2012-04-11 Thread Andy Fingerhut
On Apr 9, 2012, at 10:05 PM, Andy Wu wrote: Hi there, I'm studying algo-class.org, and one of it's programming assignment gives you a file containing contents like below: 1 2 1 7 2 100 ... There is roughly over 5 million lines, and i want to first construct a vector of vector of

Re: Read in a big file and get GC limit/outofmemory error.

2012-04-11 Thread atucker
Yet another approach that might work for you, depending on your requirements, is to use a lazy sequence to access your data. I did that for a load of Twitter data that would have been too large to hold in memory at any one time. Here's the relevant bit (I think), copied and pasted: (defn

Subtle differences in quoted and backquoted forms

2012-04-11 Thread Alex Shabanov
Here is the quick clojure sample: user= (def p1 `(or a b)) #'user/p1 user= (def p2 '(or a b)) #'user/p2 user= (= (first p1) 'or) false user= (= (first p2) 'or) true At the same time this seems unique to clojure as the clisp behavior differs: [1] (setf p1 `(or a b)) (OR A B) [2] (setf p2 '(or a

Re: Subtle differences in quoted and backquoted forms

2012-04-11 Thread Cedric Greevey
On Wed, Apr 11, 2012 at 3:56 AM, Alex Shabanov avshaba...@gmail.com wrote: Here is the quick clojure sample: user= (def p1 `(or a b)) #'user/p1 user= (def p2 '(or a b)) #'user/p2 user= (= (first p1) 'or) false user= (= (first p2) 'or) true At the same time this seems unique to clojure

Re: Subtle differences in quoted and backquoted forms

2012-04-11 Thread Alexander Shabanov
2012/4/11 Cedric Greevey cgree...@gmail.com On Wed, Apr 11, 2012 at 3:56 AM, Alex Shabanov avshaba...@gmail.com wrote: Here is the quick clojure sample: user= (def p1 `(or a b)) #'user/p1 user= (def p2 '(or a b)) #'user/p2 user= (= (first p1) 'or) false user= (= (first p2)

Re: Subtle differences in quoted and backquoted forms

2012-04-11 Thread Meikel Brandmeyer
Hi, for hygienic reasons. ` qualifies symbols, while ' does not. So `or might result in clojure.core/or, while 'or is always or. This is important. Consider the following example. (ns foo.bar) (defmacro foo-or [ body] `(or ~@body)) (ns frob.nicate (:refer-clojure :exclude [or]) (:use

Re: Subtle differences in quoted and backquoted forms

2012-04-11 Thread Alexander Shabanov
Oh, I see it. Well, it complicates the matters but at least it is not a bug :) 2012/4/11 Meikel Brandmeyer m...@kotka.de Hi, for hygienic reasons. ` qualifies symbols, while ' does not. So `or might result in clojure.core/or, while 'or is always or. This is important. Consider the following

Re: Subtle differences in quoted and backquoted forms

2012-04-11 Thread Meikel Brandmeyer
Hi, Am 11.04.2012 um 10:46 schrieb Alexander Shabanov: Oh, I see it. Well, it complicates the matters but at least it is not a bug :) In fact it makes things less complicated. You rarely want a quoted symbol in Clojure. Most of the time you'd use a keyword in such cases. Kind regards Meikel

Re: [ANN] clojure-py 0.2 released

2012-04-11 Thread Jacek Laskowski
On Tue, Apr 10, 2012 at 4:57 AM, Timothy Baldridge tbaldri...@gmail.com wrote: And it's always good to give links with a project release: While we're at it, I'd also add a one-sentence introduction about what the tool/library/framework is for (even in the subject of upcoming [ANN] emails).

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread David Nolen
As pointed out by Chouser and others the direct invocation does introduce a bit of static-ness to ClojureScript. In particular switching a top level definition from a fn to an object (which implements IFn) can cause problems. The compiler now issues warnings if this happens. Related - dynamic

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread David Powell
On Tue, Apr 10, 2012 at 6:21 PM, David Nolen dnolen.li...@gmail.com wrote: I've merged these changes in master. I've also added another change that results in yet another large perf boost: - direct invocation of known fns instead of going through .call Not sure whether this is of interest,

Re: Protocol Usage

2012-04-11 Thread tmountain
Thanks for the illuminating response. You've given me a lot to look into here, and I really appreciate the feedback! On Tuesday, April 10, 2012 5:37:20 PM UTC-4, Nick Vaidyanathan wrote: As I understand it, Protocols are intended to basically do what Interfaces do in Java: define a contract

Extracting string literals from codebase

2012-04-11 Thread Mark Fredrickson
Hello, I have a web survey/survey experiment written in Clojure. The survey is currently in English and needs to be translated into French as well. Since the program has a relatively short life span (only a few weeks) and to make life easiest for my translator, I figured my best solution would

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread David Nolen
Good point, fixed in master. On Wed, Apr 11, 2012 at 11:28 AM, David Powell djpow...@djpowell.netwrote: On Tue, Apr 10, 2012 at 6:21 PM, David Nolen dnolen.li...@gmail.comwrote: I've merged these changes in master. I've also added another change that results in yet another large perf

Re: [ANN] Quil 1.0.0

2012-04-11 Thread Changa Damany Imara
Where's the best place to ask questions or get help using quill? I have a question about drawing stuff to the screen that I don't think is really a bug, just lack of knowledge on my part. On Saturday, April 7, 2012 10:17:06 AM UTC-7, Sam Aaron wrote: On 7 April 2012 16:20, Changa Damany Imara

Re: Need help to find a bug in a genetic algorithm

2012-04-11 Thread Marcus Lindner
Thanks. I stumbled across these programs too, when I searched for evolution algorithm in clojure ;). Might be, that I can use these at work, if the need arise... Another thing about the posted code here. When the alogrithm is stopped, the start-stop-agent became the state stopped. Because

Re: Extracting string literals from codebase

2012-04-11 Thread Armando Blancas
Maybe walking the result of (read-string (str ( (slurp somefile.clj) ))) On Wednesday, April 11, 2012 9:20:31 AM UTC-7, Mark Fredrickson wrote: Hello, I have a web survey/survey experiment written in Clojure. The survey is currently in English and needs to be translated into French as

translating underscore.js to clojurescript

2012-04-11 Thread Jason Hickner
Hello, I'm working on porting underscore.js to clojurescript (at least the parts that aren't made redundant by clojurescript already). Mostly it's pretty straightforward, but for some of the trickier functions I'm having trouble finding an idiomatic translation. Here's the throttle and bounce

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread Jason Hickner
It does seem like you need to use native js data structures if you want speed. Makes sense, and it's not a big deal beyond the psychic injuries caused by going mutable. I've had to switch from vectors/maps to arrays/objects a few times due to performance. - Jason On Tuesday, April 10, 2012

Re: Need help to find a bug in a genetic algorithm

2012-04-11 Thread Lee Spector
On Apr 11, 2012, at 2:27 PM, Marcus Lindner wrote: Another thing about the posted code here. When the alogrithm is stopped, the start-stop-agent became the state stopped. Because this agent has not the state running anymore, there is no send for any other agent anymore. But these agents are

translating underscore.js to clojurescript

2012-04-11 Thread David Nolen
It might be worth investigating a more functional solution. RxJS looks like a promising project to steal ideas from. David On Wed, Apr 11, 2012 at 6:11 PM, Jason Hickner jhick...@gmail.comjavascript:_e({}, 'cvml', 'jhick...@gmail.com'); wrote: Hello, I'm working on porting underscore.js to

Re: == is not always transitive

2012-04-11 Thread Leif
I'd also like to make sure people are aware of this oddity. I discovered this after reading an article about the bad design of PHP. I read that in PHP, == is not transitive. I thought Ha ha ha, that ridiculous PHP! Then I checked c.c/== ; Imagine my reaction when I learned that Clojure

Re: translating underscore.js to clojurescript

2012-04-11 Thread Jason Hickner
Thanks, I'll check it out. - Jason On Wednesday, April 11, 2012 4:42:35 PM UTC-7, David Nolen wrote: It might be worth investigating a more functional solution. RxJS looks like a promising project to steal ideas from. David On Wed, Apr 11, 2012 at 6:11 PM, Jason Hickner

Re: == is not always transitive

2012-04-11 Thread Cedric Greevey
IME, it's almost never useful to perform equality tests on floating point values. Generally you want to know if they're near enough to one another without necessarily being exactly equal. For that something like (defn f= [f1 f2 threshold] ( (Math/abs (- f1 f2)) threshold)) is probably the sort of

Re: Need help to find a bug in a genetic algorithm

2012-04-11 Thread Marcus Lindner
Sorry. I meant the code I posted at the beginning. Not your code [1] and [2]. Sorry for causing a misunderstanding :(. Am 12.04.2012 01:36, schrieb Lee Spector: On Apr 11, 2012, at 2:27 PM, Marcus Lindner wrote: Another thing about the posted code here. When the alogrithm is stopped, the

Re: == is not always transitive

2012-04-11 Thread Sean Corfield
On Wed, Apr 11, 2012 at 5:46 PM, Leif leif.poor...@gmail.com wrote: Then I checked c.c/== ;  Imagine my reaction when I learned that Clojure had something in common with PHP.  o_O,  :'[ It's instructive to look at the result of: (let [ones [1 1.0 1N 1M 1.0M] ] (for [a ones b ones] (== a b)))

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread Brandon Bloom
Awesome work! In particular switching a top level definition from a fn to an object (which implements IFn) can cause problems. The compiler now issues warnings if this happens. I encountered something similar when implementing bound-fn and friends (see:

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread Brandon Bloom
I needed a way to get the :dynamic flag when attaching a REPL to an already-compiled front end To clarify: You need the :dynamic flag to know now to emit a direct call. I implemented IFn and IDeref on Var. When emitting :var, I had to check :dynamic to see if I could emit namespace.var