Re: java.lang.OutOfMemoryError

2010-07-27 Thread Mark Nutter
On Mon, Jul 26, 2010 at 9:53 AM, atucker agjf.tuc...@googlemail.com wrote: Here is my function: (defn json-seq []  (apply concat         (map #(do (print f) (str/split (slurp %) #\nStatusJSONImpl))              out-files))) Try removing the apply concat at the front, I'm pretty sure that's

Re: java.lang.OutOfMemoryError

2010-07-27 Thread Peter Schuller
Here is my function: (defn json-seq []  (apply concat         (map #(do (print f) (str/split (slurp %) #\nStatusJSONImpl))              out-files))) Try removing the apply concat at the front, I'm pretty sure that's making your sequence non-lazy. Correct me if I'm wrong but that should

Re: Clojure finally on SPOJ!

2010-07-27 Thread Matthias Schneider
And on nearly all problems Clojure isn't an accepted language (yet?). Does the person who submitted the problem has to update this? -matthias On Jul 25, 12:34 pm, Cachou tangtong...@gmail.com wrote: Even the TEST Problem will TLE!!! My code is here: (ns spoj-test) (defn read-int   []  

Newbie style question - implementing binary search

2010-07-27 Thread Dave Snowdon
Hi folks I've just started teaching myself clojure and for lack of a real project to use it on I've been using the code kata on pragprog.com as example problems to solve. I've implemented the binary search as described here: http://codekata.pragprog.com/2007/01/kata_two_karate.html however I'm

Enclojure uberjar

2010-07-27 Thread Dave
Has anyone been able to do something similar to lein uberjar using Enclojure? I always end up with the message: [WARNING] JAR will be empty - no content was marked for inclusion! This happens even if I make a new project where: 1) Create a project with lein new myproject 2) Edit the project

Log SQL in clojure.contrib.sql

2010-07-27 Thread ngocdaothanh
Hi, I would like to ask if there is a way to log SQL generated by clojure.contrib.sql to console for inspection. Thanks. -- 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

Re: Clojure finally on SPOJ!

2010-07-27 Thread Nikita Beloglazov
Yes, it would be great to see example of any program, that passed all tests on spoj written in clojure. Even if first task has got TLE... On Jul 25, 12:34 pm, Cachou tangtong...@gmail.com wrote: Even the TEST Problem will TLE!!! -- You received this message because you are subscribed to

Re: Feedback on Clojure web development post

2010-07-27 Thread Savanni D'Gerinel
I thought this was pretty awesomely informative, including the deployment to Amazon Cloud. I already playing through and doing development with Compojure and Hiccup, and I found a lot of new things in here for me to investigate and potentially put to good use. -- Savanni On Sat, 2010-07-24 at

Re: Newbie style question - implementing binary search

2010-07-27 Thread Joost
Dave Snowdon wrote: ; helper function that splits a collection into halves (defn halve [coll] (let [len (count coll), hl (- len (/ len 2))] [(take hl coll) (drop hl coll)] ) ) ; takes a value and an ordered sequence and returns the index of the value or -1 (defn chop [val

Re: java.lang.OutOfMemoryError

2010-07-27 Thread atucker
Thanks! but not entirely convinced. At my REPL: user (repeatedly 10 #(do (print f) [(rand-int 10)])) (ff[0] f[8] f[5] f[7] f[1] f[6] f[7] f[3] f[3] [0]) user (take 5 (apply concat (repeatedly 10 #(do (print f) [(rand-int 10)] (7 1 f6 f5 8) Only six fs... so doesn't that mean the

Re: java.lang.OutOfMemoryError

2010-07-27 Thread atucker
Thanks Sean, your first suggestion was a very good one :) Tweaking JVM settings feels like advanced magic, and I am a little surprised that it is necessary at such an early stage in my Clojure journey. But googling confirms that the default JVM settings are miserly to an extreme, and I need at

Re: java.lang.OutOfMemoryError

2010-07-27 Thread Peter Schuller
I am getting a lot further now, but still running into OutOfMemory errors sometimes.  And it is still the case that once I have suffered an OutOfMemoryError, they keep coming.  It does feel as if there must be some large memory leak in the emacs/lein swank repl.  Is this a recognised issue?

bit-and type hint

2010-07-27 Thread Peter Ryan
I am trying to avoid a reflective callback with this function: (defn unsign-byte-from-buffer [#^java.nio.ByteBuffer buffer] (bit-and 0xFF (.get buffer))) (println should be 254 (unsign-byte-from-buffer (java.nio.ByteBuffer/ wrap (byte-array [(byte 0xFE)] when run with (set!

fast development through clojure repl

2010-07-27 Thread Josh Stratton
I think one of the major advantages touted by languages like clojure are faster development times by adding to the program as you go via the REPL. I, however, have still been doing a more traditional write/save/execute debugging workflow without the REPL, which doesn't seem to get the real

Re: fast development through clojure repl

2010-07-27 Thread Peter Schuller
I, however, have still been doing a more traditional write/save/execute debugging workflow without the REPL, which doesn't seem to get the real benefits of the REPL.  From what I understand, when you take full advantage of the REPL, you can quickly tweak things in the code like if a function

Re: fast development through clojure repl

2010-07-27 Thread Joost
Josh Stratton wrote: Are there any tutorials specific to developing and debugging large clojure apps through the REPL? While some people seem to really love going through the REPL all the time, personally I prefer something a little more integrated with my editor. I use the above mentioned

newbie question casting java classes/interfaces

2010-07-27 Thread Sandeep Puri
The snippet below works fine GraphDatabaseService neo = new EmbeddedGraphDatabase(dbpath); MetaModel model = new MetaModelImpl((NeoService) neo); Where MetaModelImpl expects a NeoService trying to do the same thing in clojure (let [^NeoService neo (EmbeddedGraphDatabase. dbpath) model

Re: bit-and type hint

2010-07-27 Thread Joost
Peter Ryan wrote: I am trying to avoid a reflective callback with this function: (defn unsign-byte-from-buffer [#^java.nio.ByteBuffer buffer] (bit-and 0xFF (.get buffer))) (println should be 254 (unsign-byte-from-buffer (java.nio.ByteBuffer/ wrap (byte-array [(byte 0xFE)] when run

destructuring using :as in fn arg vector

2010-07-27 Thread Cameron
Hey all, just wondering if this is normal or not. There seems to be something weird going on with :as in a functions arg vector. This little example works as I'd expect... user= (defn foo [[a b :as c]] c) #'user/foo user= (foo [1 2]) [1 2] But this one does not user= (defn foo [a b :as c] c)

Re: destructuring using :as in fn arg vector

2010-07-27 Thread Randy Hudson
The form you're looking for is (defn foo [ [a b :as c]] ...) On Jul 27, 2:57 pm, Cameron cpuls...@gmail.com wrote: Hey all, just wondering if this is normal or not. There seems to be something weird going on with :as in a functions arg vector. This little example works as I'd expect...

Dynamic defrecord

2010-07-27 Thread WoodHacker
All the examples of defrecord I see seem simple enough and when I experiment in the REPL I get things to work as they should. However, when I move to 'real' code I can't get it to work at all. The problem at hand is simple enough - I want to create a record that hold records. For example I

Re: Dynamic defrecord

2010-07-27 Thread Stuart Halloway
Hi Bill, There are several issues here: (1) A confusion of record and instance. You are asking for the :list1 field from foo, the record type, not from an instance of the type. (:list1 foo) s/b (:list1 MyFoo) (2) You are ignoring the return value of assoc. Remember, Clojure data

Re: fast development through clojure repl

2010-07-27 Thread Josh Stratton
If you're rather looking for overall workflows/program structure/best practices etc - good question. :) I was actually, but the integration with emacs is important, too. I'll have to get SLIME working. Thanks. -- You received this message because you are subscribed to the Google Groups