Re: labrepl: kl...@feersum:~/projects/labrepl$ script/repl java.lang.ExceptionInInitializerError (control.clj:9)

2010-05-01 Thread Karsten Lang
now, _that's_ what I call a bright idea! :-) Thank you very much /klang On Fri, Apr 30, 2010 at 11:06 AM, Alex Osborne wrote: > klang writes: >> laprepl starts up with the following error and localhost:8080 does not >> respond >> >> kl...@feersum:~/projects/labrepl$ script/repl >> Clojure 1.2.

Re: labrepl: kl...@feersum:~/projects/labrepl$ script/repl java.lang.ExceptionInInitializerError (control.clj:9)

2010-05-01 Thread Karsten Lang
It works, thank you! (Initially, I had missed the bright idea of just using a version a few days old .. but then again, then it would be a few more days before problems were found) /klang On Fri, Apr 30, 2010 at 3:35 PM, Stuart Halloway wrote: > I will check in a fix later this morning. > > Stu

Re: clojure 1.2 seq fn enhancement FAQ

2010-05-01 Thread Heinz N. Gies
On Apr 30, 2010, at 14:33 , Rich Hickey wrote: > > 'contains?' and 'get' abstract over fast lookup. They are polymorphic on the > collection type and on the nature of the looked-up thing. For maps the > looked-up thing is a key, for sets: a value, for vectors, strings and arrays: > an index.

Re: something stupid I'm trying to do

2010-05-01 Thread Michał Marczyk
On 1 May 2010 03:19, Mark J. Reed wrote: >> Another version: >> >> (defn pairup [& args] >>  (map vector args (rest args))) > > Nope, that doubles the middle elements: > user=> (pairup 1 2 3 4) > ([1 2] [2 3] [3 4]) Ouch, right, forgot to include take-nth: (defn pairup [& args] (take-nth 2 (ma

Re: Try + finally question

2010-05-01 Thread ka
Hmm .. makes sense .. my thinking was its just a more flexible with- open ... but from user's pov with-open-close is better... Thanx On Apr 29, 2:24 pm, Laurent PETIT wrote: > Maybe juste the name ? > > wouldn't with-open-close be a better reminder of how the bindings are > constructed ? > > 201

Re: something stupid I'm trying to do

2010-05-01 Thread Michał Marczyk
Um, got a typo in there; "up to 2x that time" was meant to be "up to 3x that time". -- 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 b

Re: clojure 1.2 seq fn enhancement FAQ

2010-05-01 Thread Michał Marczyk
If "contains?" is a sensible name for that function, then surely "seq-contains?" cannot be a sensible name for a function which checks a totally different sort of "containment"? Also, if it is possible to view "seq-contains?" as a sensible enough name for a core library function with sequential se

Re: rand-int with bignums

2010-05-01 Thread Lee Spector
Sorry, the expression in my first sentence should have been "(. (new java.util.Random) (nextInt X))", not "(. (new java.util.Random) X)". In any event the real question isn't about this call but about how Clojure's rand-int should handle bignum arguments and about how to write a real random big

Re: rand-int with bignums

2010-05-01 Thread Per Vognsen
On Sat, May 1, 2010 at 7:25 PM, Lee Spector wrote: > about how to write a real random bignum generator. Let n be the bignum upper bound on the desired range. Find the quotient q and remainder r of n by b = 2^31-1. Generate q random numbers with upper bound b and one random number with upper bound

Re: rand-int with bignums

2010-05-01 Thread Per Vognsen
Hmm, actually, that doesn't give numbers in the right range because of the way the remainder is handled. You could round up the remainder to the nearest power of two and then generate random coefficients using rejection sampling but that's not as nice as a closed form solution. Probably any of the

Re: rand-int with bignums

2010-05-01 Thread Alex Osborne
Lee Spector writes: > Sorry, the expression in my first sentence should have been "(. (new > java.util.Random) (nextInt X))", not "(. (new java.util.Random) > X)". In any event the real question isn't about this call but about > how Clojure's rand-int should handle bignum arguments and about how

Re: Clojure Concurrency Screencast Available

2010-05-01 Thread e
interesting so far. the format I first tried didn't work on my droid, but no big deal. one, kind-of Eureka moment I just had, which is somewhat blasphemous, I guess: Craig is going through how a vector is [1 2 3] but a list has to be '(1 2 3)? Well, that may be one of the turn-offs people have

Re: clojure box: Problem with classpath (noob question)

2010-05-01 Thread Rainer
Hello Shawn, thank you for help. Yes, I am using Clojure Box 1.1.0. I changed my .emacs-file to: (setq swank-clojure-classpaths (list "c:/Clojure")) I still get the same error. Since I am a total emacs newbie, I might be making a stupid mistake that might not be obvious to advanc

Re: something stupid I'm trying to do

2010-05-01 Thread john.holland
much thanks for the insight-giving answers from you all On Apr 30, 12:29 pm, "Mark J. Reed" wrote: > On Fri, Apr 30, 2010 at 12:25 PM, Mark J. Reed wrote: > > > I got an error when I tried ([a b]) instead of (list [a b]), by the way: > > > Clojure 1.1.0 > > user=> (cons [1 2] ([3 4])

Re: labrepl updated

2010-05-01 Thread Keno
I'm getting an error using labrepl in Eclipse. I followed these instructions: http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Eclipse_and_Counterclockwise. This is what I get: Clojure 1.2.0-master-SNAPSHOT 1:1 user=> * (require 'labrepl) * (labrepl/-main) # java.lang.Except

Re: labrepl updated

2010-05-01 Thread Keno
I'm getting this error in Eclipse: Clojure 1.2.0-master-SNAPSHOT 1:1 user=> * (require 'labrepl) * (labrepl/-main) # java.lang.ExceptionInInitializerError (control.clj:9) 1:2 user=> # 1:3 user=> java.lang.Exception: No such var: labrepl/-main (repl-1:2) Do you maybe have an idea what I'm

Re: something stupid I'm trying to do

2010-05-01 Thread devender
(def even-nums [1 2 3 4 5 6 7 8]) (defn pairup [collection] (loop [coll collection results []] (if (> (count coll) 0) (recur (drop 2 coll) (conj results (take 2 coll))) results))) user> (pairup even-nums) [(1 2) (3 4) (5 6) (7 8)] On Apr 29, 12:32 pm, "john.holland" wrote: >

Re: something stupid I'm trying to do

2010-05-01 Thread Sean Corfield
On Fri, Apr 30, 2010 at 2:30 PM, Michael Wood wrote: > On 30 April 2010 18:25, Mark J. Reed wrote: > [...] >> (defn pairup >>     ([a b] (list [a b])) >>     ([a b & rest]   (cons [a b] (apply pairup rest Why not: (defn pairup ( [] nil ) ( [ a b & rest ] ( cons [ a b ] ( apply pairu

Re: rand-int with bignums

2010-05-01 Thread Chris Riddoch
On Fri, Apr 30, 2010 at 8:56 PM, Lee Spector wrote: > > In an earlier thread, in which I learned (from Timothy Pratley) that (. (new > java.util.Random) X) gives an error if X is a bignum, I said that at least > Clojure's rand-int "does the right thing." > > Upon further investigation I see that

Re: rand-int with bignums

2010-05-01 Thread Chris Riddoch
Sorry, it just occurred to me after I hit send: (defn huge-random-number [digits] (BigDecimal. (apply str (take digits (repeatedly #(rand-int 10)) user=> (defn huge-random-number [digits] (BigDecimal. (apply str (take digits (repeatedly #(rand-int 10)) #'user/huge-random-number user=>

Debugger REPL feature request

2010-05-01 Thread JS
Clojure is awesome, no doubt. But I feel it is distinctly lacking a feature that would make it a power-house lisp. I was working with MIT scheme the other day and I noticed just how very nice having a debug break in the repl is. Once can look at the bindings, execute programs within a particular

Re: Any Clojure job out there?

2010-05-01 Thread ieslick
I think the winds are changing out there with regards to company's willingness to explore multiple or alternative languages. Compass Labs is a silicon valley based social media startup company. Their data mining team just switched all their internal tools and data mining work to Clojure (productio

Re: Debugger REPL feature request

2010-05-01 Thread Phil Hagelberg
On Sat, May 1, 2010 at 1:04 PM, JS wrote: > I was working with MIT scheme the other day and I noticed just how > very nice having a debug break in the repl is. Once can look at the > bindings, execute programs within a particular frame, etc. MIT Scheme > has a very nice IDE(Edwin) based debugger t

Trouble with Leiningen and Autodoc

2010-05-01 Thread joshua-choi
This is my project.clj: (defproject fnparse "3.α.3" :description "A library for creating functional parsers in Clojure." :dependencies [[org.clojure/clojure "1.2.0-master-SNAPSHOT"] [org.clojure/clojure-contrib "1.2.0-master- SNAPSHOT"]] :dev-dependencies [[autodoc "0.7.0"]]

Re: Clojure Concurrency Screencast Available

2010-05-01 Thread e
And ... in another Ah-ha based on an email I just received on this subject ... what should really be said here is that there should be an explicit symbol to say that the first argument of the list is receiving "special treatment" (the words of the emailer). Well, that got me thinking: Now I know

Re: Clojure Concurrency Screencast Available

2010-05-01 Thread Alex Osborne
e writes: > Can you imagine how disruptive it would be at this point to do it the > other way around?  If you were starting out today without any Lisp > baggage, it seems TOTALLY obvious to me that lists would have been (1 > 2 3), and the *calling of a function* would have been the different > th

Re: Clojure Concurrency Screencast Available

2010-05-01 Thread e
doesn't sound like you are misunderstanding. Data is data, first and foremost in that model. you have to work to turn something into a function. other than functions, everything is data. That's the JSON way, for sure. When something is a function, you see things like "eval" and "function" in j