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.
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
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.
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
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
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
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
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
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
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
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
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
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
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])
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
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
(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:
>
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
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
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=>
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
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
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
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"]]
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
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
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
27 matches
Mail list logo