Re: much lower recursion depth with memoization

2013-09-23 Thread yair
Of course John, the reason you can do the sum of 1-200 in your head is thanks to Gauss's formula, I'm assuming you're not really recursing 200 times in your head :) Love your blog too BTW, especially your style of presentation and the types of things you write about (i.e. non-trivial but still

Re: What's your preference, partial or closures?

2013-08-17 Thread yair
What do you mean by currying in this context? Is there a way to do this in clojure apart from using partial? On Saturday, August 17, 2013 10:04:23 AM UTC+10, Sean Corfield wrote: > > I went down the partial path for a long time but have moved more and > more toward currying and closures lately

Re: newbie struggling with Clooj and jars

2013-08-11 Thread yair
The problem is that clooj depends on leiningen 1 which used to have the dependencies in the /lib directory of the project. Leiningen 2 use the maven repo directory (typically ~/.m2) for dependencies and builds the classpath directly to those jars, which you can check by running 'lein classpath

Re: Should ` ` be trimmed using `clojure.string/trim`? EOM

2013-08-11 Thread yair
I think the expectation most people would have (I certainly do) is that it behave identically to java.lang.String.trim() as described here: http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#trim(), so no, it most certainly should not. Besides, HTML is just one format, there are ma

Re: How would I learn more about Clojure's class loading system?

2012-01-05 Thread yair
Hi Daniel, While this may not be all-inclusive, there could be two main reasons for the error. 1. You don't really have all the jars required. This is easy to check. A jar is just a zip file really and can be viewed (jar -tvf ). Look for the class file in there that matches the class that is b

Re: Trying to understand performance of two simple functions

2011-08-03 Thread yair
No you didn't misinterpret it, I thought that would have been the cause. I ran a test and I think the de-structuring might have something to do with it. Here's the test: (defn count-slow [[x & xs] acc] (if (empty? xs) (inc acc) (recur xs (inc acc (defn count-fast [xs acc] (if (empty? (r

Re: Trying to understand performance of two simple functions

2011-08-02 Thread yair
I suspect this is because concat-ing is more expensive than cons-ing for non-vectors... On Aug 3, 11:25 am, Mark Feeney wrote: -- 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 po

Re: java.lang.StackOverflowError when calling function name instead of recur

2011-08-02 Thread yair
To add a bit to this, the JVM does not support tail call recursion. As I understand it, Clojure compiles into bytecode that effectively turns the recurs into an iterative process. Scala does something similar but automatically (i.e. you don't have to use a specific keyword). The advantage to Cloj

Re: Libraries and build management hell

2011-07-31 Thread yair
On Jul 31, 12:28 pm, Ken Wesson wrote: > "Almost" being the operative word. One distinct disadvantage is that > it makes building your project require a working network connection This is not correct. Once the jar has been downloaded after being included in the dependencies, it stays in your lo

A Couple of emacs questions

2011-07-22 Thread yair
I searched google for these but came up short, I was wondering if anyone here could help. I use emacs with clojure and really like it. There are two things I haven't been able to do successfully so far. 1. Following the CDT instructions here (http://georgejahad.com/clojure/ swank-cdt.html), I can

Re: Emacs setup - quick navigation to files and definitions

2011-06-12 Thread yair
ks not only in your > own code but also in all contrib libraries. > So what else do you need ? > > On Jun 12, 6:50 pm, yair wrote: > > > > > > > > > Hi, > > > With swank and slime all set-up along with CDT, further improved by > > slime aut

Emacs setup - quick navigation to files and definitions

2011-06-12 Thread yair
Hi, With swank and slime all set-up along with CDT, further improved by slime autocomplete, my emacs setup is getting pretty close to being a full featured, highly clojure focused IDE. One thing I am struggling with while working on a larger than usual project (i.e. 7 source files some of which h

Re: porting an old project - where to begin?

2011-06-06 Thread yair
I'm using processing in a Java2D program. It doesn't have to be 3D... On Jun 4, 5:24 pm, Daniel wrote: > I suppose the noob tag is appropriate ie I was around sometime last > year and earlier but RLing got in the way of doing anything useful > with this lovely language. > > Anyway, I've got this

Re: Best/Idiomatic way of managing data that changes

2011-06-02 Thread yair
bably get at your data pretty easily.  Create a couple > functions to handle moving location, updating properties, etc., and > you might find that it isn't ugliness that you are hiding :-) > > On Jun 1, 11:12 am, yair wrote: > > > > > > > > > Hi, > >

Best/Idiomatic way of managing data that changes

2011-06-01 Thread yair
Hi, I am writing a little board game in clojure, mostly to educate myself about how to organise and implement a larger-scale program than my usual tiny little snippets. The program has a central data structure of units which are placed on a map. Each unit has some information like a name, moveme

Re: Transforming map entries

2011-02-22 Thread yair
here would have to be two versions of it, one expecting a function > with an arity of one (for just the value) and another expecting an arity of > two (key and value). > > > > > > > > On Mon, Feb 21, 2011 at 10:08 PM, yair wrote: > > I'm hoping this is a dumb

Transforming map entries

2011-02-22 Thread yair
I'm hoping this is a dumb question and I've missed something obvious. I have a map with various key-value pairs and I want to transform some of the values, e.g. (def mymap {:first "john" :last "smith" :age 25}) and say I want to change the strings to be upper case. Right now all I can think of doi