Re: Deep recursion, continuation passing style, trampolining and memoization

2011-03-22 Thread Christian Schuhegger
Actually Mark is right. My point is not about the Levenshtein distance. I've even found a quite nice and concise implementation here on the list a few weeks ago: "generic (works for any seq) levenshtein distance" https://groups.google.com/group/clojure/browse_frm/thread/c5da3ac1b6704eda My point i

Re: complication using re-gsub having special chars in replacement string

2011-03-22 Thread Tim Robinson
Perfect. Thanks for the help. Tim On Mar 22, 9:11 pm, Alan wrote: > $ is a special character in replacements as well, for indicating > capturing-subgroups. > > user> (require '[clojure.string :as s]) > nil > user> (s/replace "stuff$@stuff" #"\$@" "\\$@sub") > "stuff$@substuff" > > On Mar 22, 8:05

Re: complication using re-gsub having special chars in replacement string

2011-03-22 Thread Alan
$ is a special character in replacements as well, for indicating capturing-subgroups. user> (require '[clojure.string :as s]) nil user> (s/replace "stuff$@stuff" #"\$@" "\\$@sub") "stuff$@substuff" On Mar 22, 8:05 pm, Tim Robinson wrote: > I'm not well versed in regex functions., so I'm probably

complication using re-gsub having special chars in replacement string

2011-03-22 Thread Tim Robinson
I'm not well versed in regex functions., so I'm probably missing something really obvious. => (re-gsub #"\$@" "--" "stuff$@stuff") "stuff--stuff" =>(re-gsub #"\$@" "$@" "stuff$@stuff") java.lang.IllegalArgumentException: Illegal group reference (NO_SOURCE_FILE:0) Anyone run into this and have a

Re: one argument versions of conj and disj would be very nice

2011-03-22 Thread Sunil S Nandihalli
Thanks Ken .. "into" is cool .. it does better.. Sunil. On Tue, Mar 22, 2011 at 4:09 PM, Ken Wesson wrote: > On Tue, Mar 22, 2011 at 5:08 AM, Shantanu Kumar > wrote: > > On Mar 22, 1:15 pm, Sunil S Nandihalli > > wrote: > >> Hello everybody, > >> I was wondering why there is no 1 argument ver

Re: Beginning Clojure

2011-03-22 Thread Alan
http://www.try-clojure.org/ I hear it's not always working, but it seems to be up now. On Mar 22, 4:55 pm, Kyle Cordes wrote: > On Tuesday, March 22, 2011 at 7:16 AM, André Branco wrote: > > Hi! > > > A good collection of resources: > >http://learn-clojure.com/ > > Thanks for the mention (that's

Re: Beginning Clojure

2011-03-22 Thread Kyle Cordes
On Tuesday, March 22, 2011 at 7:16 AM, André Branco wrote: Hi! > A good collection of resources: > http://learn-clojure.com/ Thanks for the mention (that's my site). By the way, I'm on the lookout for any other really good materials to help people get started. It's tempting to add every resourc

Re: beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Avram
Thanks, Stuart. > With Leiningen, you can add the :jvm-opts option in project.clj, Cool, this is what I was looking for :) >     (def signals (vec ...)) > > says that you want the entire result, as a vector, stored as the value of > the Var `signals`.  That means your entire result data must fi

Re: Deep recursion, continuation passing style, trampolining and memoization

2011-03-22 Thread Jonathan Smith
I'm wondering if it wouldn't be better to simply implement it using a mutable 2d Java array? (the standard imperative implementation). It wouldn't be a 'purely functional' answer, but the array wouldn't leak out of the levenshtein-distance function. On Mar 22, 3:09 am, Christian Schuhegger wrot

Re: beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Avram
Thanks, Ken. > You'll need to avoid holding onto the head of your line-seq, which > means you'll need to make multiple passes over the data, one for the > as, one for the bs, and etc., with the output a lazy seq of lazy seqs. Actually, it would be great to make separate, asynchronous passes for t

Re: beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Stuart Sierra
Oh, and the standard JDK class java.util.zip.GZIPInputStream implements gzip decompression. -Stuart Sierra clojure.com -- 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

Re: beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Stuart Sierra
Hi Avram, Assuming you're using the Sun/Oracle JDK, you can increase the size of the Java heap with the -Xmx command-line option. For example: java -Xmx512mb -cp clojure.jar:your-source-dir clojure.main Will run Java with a 512 MB heap. This increases the amount of memory available to yo

Re: beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Ken Wesson
On Tue, Mar 22, 2011 at 4:00 PM, Avram wrote: > Hi, > > I (still) consider myself new to clojure.  I am trying to read a 37Mb > file that will grow 500k every 2 days. I don't consider this to be > input large enough file to merit using Hadoop and I'd like to process > it in Clojure in an efficient

Re: fs - file system utilities for Clojure

2011-03-22 Thread Daniel Werner
On 22 March 2011 05:47, Shantanu Kumar wrote: > On Mar 22, 3:29 am, siyu798 wrote: >> (dirname "/a/b/c") should return "/a/b/" on both win and unix > > You can write such a function yourself. Irrespective of the platform, > Java works fine with '/' as a separator in the filename. In fact, this i

beginner clojure question: OutOfMemory error processing (slightly) large data file

2011-03-22 Thread Avram
Hi, I (still) consider myself new to clojure. I am trying to read a 37Mb file that will grow 500k every 2 days. I don't consider this to be input large enough file to merit using Hadoop and I'd like to process it in Clojure in an efficient, speedy, and idiomatic way. I simply want something akin

Re: Deep recursion, continuation passing style, trampolining and memoization

2011-03-22 Thread Chas Emerick
On Mar 22, 2011, at 12:30 PM, Mark Engelberg wrote: > Of course, in most languages the Levenshtein distance is computed using the > bottom-up Dynamic Programming strategy of filling in a matrix left-to-right, > one row at a time, thus ensuring that all the entries needed to compute a > given e

Re: Deep recursion, continuation passing style, trampolining and memoization

2011-03-22 Thread Mark Engelberg
I don't believe Tim's comments are correct. Since there are three recursive calls, I don't think there is a straightforward transformation to tail position using an accumulator. Also, due to the interleaved nature of the recursive calls, I would expect memoization to be essential. So, I think th

Re: [ANN] fs - file system utilities for Clojure

2011-03-22 Thread siyu798
Miki, We do have functions to normalize and convert path and I just think the dirname function should not do the conversion. In fact there's no benefits to do so as /a/b/c on *nix is not equal to \a\b\c in window, same goes for c:\a\b\c in window for c:/a/b/c in *nix. In 99.99% percent of th

Re: Deep recursion, continuation passing style, trampolining and memoization

2011-03-22 Thread Tim Webster
A few things: --clojure does not do automatic TCO, so you might want to look at recur to handle your stack issue --recur won't work unless you rewrite your function so that the recursive call is in tail position --you probably can do that rewrite by passing around the levenshtein grid as an accumul

Re: Beginning Clojure

2011-03-22 Thread André Branco
Hi! A good collection of resources: http://learn-clojure.com/ You may also trying solving this: Ninety-Nine Lisp Problems http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html Regards, André. On Mar 20, 8:08 pm, Ent SaaS wrote: > Hi, > > I would

Re: one argument versions of conj and disj would be very nice

2011-03-22 Thread Ken Wesson
On Tue, Mar 22, 2011 at 5:08 AM, Shantanu Kumar wrote: > On Mar 22, 1:15 pm, Sunil S Nandihalli > wrote: >> Hello everybody, >>  I was wondering why there is no 1 argument version of conj and disj. I >> think that would be very convenient. Especially when used in the following >> way >> >> (apply

Re: About a networked REPL...

2011-03-22 Thread Chas Emerick
On Mar 22, 2011, at 1:44 AM, Martin Blais wrote: >> The operations that would be provided by a tooling library would >> have zero impact on the nREPL protocol. There's no reason why a >> particular client would have to either (a) use the server's >> provided set of tooling functions or (b) use an

Re: one argument versions of conj and disj would be very nice

2011-03-22 Thread Sunil S Nandihalli
Thanks Shanthanu .. Sunil. On Tue, Mar 22, 2011 at 2:38 PM, Shantanu Kumar wrote: > > > On Mar 22, 1:15 pm, Sunil S Nandihalli > wrote: > > Hello everybody, > > I was wondering why there is no 1 argument version of conj and disj. I > > think that would be very convenient. Especially when used i

Re: one argument versions of conj and disj would be very nice

2011-03-22 Thread Shantanu Kumar
On Mar 22, 1:15 pm, Sunil S Nandihalli wrote: > Hello everybody, >  I was wondering why there is no 1 argument version of conj and disj. I > think that would be very convenient. Especially when used in the following > way > > (apply conj some-collection collection-of-elements-to-be-conjed) > > C

one argument versions of conj and disj would be very nice

2011-03-22 Thread Sunil S Nandihalli
Hello everybody, I was wondering why there is no 1 argument version of conj and disj. I think that would be very convenient. Especially when used in the following way (apply conj some-collection collection-of-elements-to-be-conjed) Currently the above usage would fail for both conj and disj when

Deep recursion, continuation passing style, trampolining and memoization

2011-03-22 Thread Christian Schuhegger
Hello all, I've implemented the levenshtein measure in clojure and am quite happy with it except that I run into stack overflows if I hand over long strings. My current solution looks like this: -- snip start -- (declare levenshtein-rec) (declare change-cost) (defn levenshtein "Compute Levenshte

Re: About a networked REPL...

2011-03-22 Thread Meikel Brandmeyer
Hi, On 22 Mrz., 06:44, Martin Blais wrote: > > Why does a synchronuous version break less than an async one? And > > besides: it's good enough for a lot of users, but it is not good > > enough for me. > > Why does Slime with Clojure-1.3 not work right now? I think, I understand now. I got a mis