On Sat, Jun 19, 2010 at 11:22 PM, Mike Meyer
wrote:
>
> "Rob Lachlan" wrote:
>
>>Actually, Mike, your two functions work just fine. (Equal branch).
>>Mind you I checked that out over two hours ago, so this information
>>might be out of date.
>>
>>Rob
>>
>>On Jun 19, 6:59 pm, Mike Meyer
> Ok, wh
"Rob Lachlan" wrote:
>Because the compiler is upset that it doesn't know what n is. r is a
>long, but n is ???. The following works:
>
>(defn ^:static fact [^long n]
> (loop [n n r 1]
>(if (zero? n)
> r
> (recur (dec n) (* r n)
>
>Or see Dnolen's version above. But yeah, I
Because the compiler is upset that it doesn't know what n is. r is a
long, but n is ???. The following works:
(defn ^:static fact [^long n]
(loop [n n r 1]
(if (zero? n)
r
(recur (dec n) (* r n)
Or see Dnolen's version above. But yeah, I wish that it still worked,
because
"Rob Lachlan" wrote:
>Actually, Mike, your two functions work just fine. (Equal branch).
>Mind you I checked that out over two hours ago, so this information
>might be out of date.
>
>Rob
>
>On Jun 19, 6:59 pm, Mike Meyer > (defn count-in [value col]
>> (loop [value value col col res 0]
>>
This answer is couple months too late but I was messing with robocode
this weekend, had the same problem OP had. The solution is to unzip
clojure.jar into the folder where your compiled class files are. That
makes the error go away but it will also increase robocode's boot time
by 20-30 secs.
Hope
I don't think my computer has enough memory to test that. But, you're
right, I might have spoken hastily.
Rob
On Jun 19, 7:26 pm, Aaron Cohen wrote:
> I actually believe it will throw an overflow exception if col contains
> more than Integer.MAX_VALUE elements. Hard to confirm without getting
>
I actually believe it will throw an overflow exception if col contains
more than Integer.MAX_VALUE elements. Hard to confirm without getting
bored though.
-- Aaron
On Sat, Jun 19, 2010 at 10:19 PM, Rob Lachlan wrote:
> Actually, Mike, your two functions work just fine. (Equal branch).
> Mind yo
On 20 June 2010 03:59, Mike Meyer
wrote:
> So here's some new
> examples, pulled in sequence from some of my combinatorics code:
This works fine as far as arithmetic ops are concerned, though I
suppose it might suffer from issues of = vs. == now (which is a
separate matter).
Sincerely,
Michał
-
Actually, Mike, your two functions work just fine. (Equal branch).
Mind you I checked that out over two hours ago, so this information
might be out of date.
Rob
On Jun 19, 6:59 pm, Mike Meyer wrote:
> On Sat, 19 Jun 2010 20:40:13 -0400
>
> David Nolen wrote:
> > Mark and Mike you fail to addre
On 20 June 2010 02:13, David Nolen wrote:
> On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk
> wrote:
>> (defn fact [n]
>> (loop [n n r 1]
>> (if (zero? n)
>> r
>> (recur (dec n) (* r n)
> Huh? That doesn't look like it's going to work at all.
> 1) 1 is primitive, we know that, a
On Sat, 19 Jun 2010 20:40:13 -0400
David Nolen wrote:
> Mark and Mike you fail to address my deeper question.
Maybe because you've failed to ask in your hurry to claim code is
non-idiomatic or calling our example rhetoric.
> I've been using
> many different Clojure libraries all day long with t
On 19 June 2010 18:59, Albert Cardona wrote:
> 1. How come APersistentMap$KeySet doesn't implement IPersistentSet?
Beyond what Rob has already written above, keys works with
APersistentMap$KeySeq (note the "q" at the end), not
APersistentMap$KeySet. To get at the latter, use (.keySet {:a 1 :b
2})
Mark and Mike you fail to address my deeper question. I've been using
many different Clojure libraries all day long with the latest equals
branch. Guess
what?
No loop/recur bugs.
When you guys start postIng your broken code that has this problem
then people can start believing it is an issue for
The main example for recur on the special forms page (http://
clojure.org/special_forms#Special%20Forms--(recur%20exprs*)) is:
(def factorial
(fn [n]
(loop [cnt n acc 1]
(if (zero? cnt)
acc
(recur (dec cnt) (* acc cnt))
I may not be be clojure jedi, but I've
On Sat, 19 Jun 2010 20:13:07 -0400
David Nolen wrote:
> On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk
> wrote:
> > (defn fact [n]
> > (loop [n n r 1]
> >(if (zero? n)
> > r
> > (recur (dec n) (* r n)
>
> Huh? That doesn't look like it's going to work at all.
>
> 1) 1 is pr
On Sat, Jun 19, 2010 at 5:13 PM, David Nolen wrote:
> Huh? That doesn't look like it's going to work at all.
> 1) 1 is primitive, we know that, accept it
> 2) we don't know the type of n, what will (* r n) be?
> 3) BOOM!
Yes David, if you have a deep understanding of how loop/recur
interacts with
> Where can I get jar files of the various branches so I can test for
> myself without having to deploy whatever infrastructure is needed to
> build clojure these days? Or am I likely to be able to build them with
> tools found in the BSD ports tree?
It still seems to build with 'ant' like it alwa
On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk
wrote:
> (defn fact [n]
> (loop [n n r 1]
>(if (zero? n)
> r
> (recur (dec n) (* r n)
Huh? That doesn't look like it's going to work at all.
1) 1 is primitive, we know that, accept it
2) we don't know the type of n, what will (*
On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk
wrote:
> (defn fact [n]
> (loop [n n r 1]
> (if (zero? n)
> r
> (recur (dec n) (* r n)
Thanks for posting this surprisingly simple example of something that
looks like it should work, but wouldn't under the current proposal.
Really
On 19 June 2010 23:51, Mike Meyer
wrote:
> In any case, I don't think 10% is enough gain to justify narrowing the
> range for which naive programs are correct. An order of magnitude
> would be. A factor of two is a maybe.
QFT!
Have a look at this:
(defn fact [n]
(loop [n n r 1]
(if (zero?
On 19 June 2010 16:43, David Nolen wrote:
> "Most real world programs". You mean like Clojure itself?
> Please look over the implementation of gvec before making statements like
> this:
Surely Clojure's internals are a *very* special case though... I
wouldn't find it particularly worrying if they
On Sat, 19 Jun 2010 22:27:05 +0100
Nicolas Oury wrote:
> On Sat, Jun 19, 2010 at 10:15 PM, Mike Meyer wrote:
> > Pretty much any time I really need integer speed, I also deal with
> > numbers that can get much larger than 10^19th, because I tend to be
> > doing combinatorics or cryptography.
> B
On Sat, Jun 19, 2010 at 10:15 PM, Mike Meyer wrote:
>
>
> Pretty much any time I really need integer speed, I also deal with
> numbers that can get much larger than 10^19th, because I tend to be
> doing combinatorics or cryptography.
>
> But you would agree that for this kind of domain, it wouldn
On Sat, 19 Jun 2010 20:20:48 +0100
Nicolas Oury wrote:
> Not "ordinary" code. 10^19 is big.
No, Aleph-2 is big. Any non-infinite number you can name in your
lifetime is small ;-).
Pretty much any time I really need integer speed, I also deal with
numbers that can get much larger than 10^19th, b
While I generally favor correct over fast (worrying about fast before
you're correct is a good sign that you're engaged in premature
optimization), I'm still trying to figure out the tradeoffs
here. Especially since most LISPs & other dynamic languages don't seem
to run into this issue - or at leas
On Sat, 19 Jun 2010 10:43:36 -0400
David Nolen wrote:
> On Sat, Jun 19, 2010 at 5:13 AM, Mike Meyer <
> mwm-keyword-googlegroups.620...@mired.org> wrote:
> >
> >
> > Were those real world programs, or arithmetic benchmarks? Most real world
> > programs I see spend so little of their time doing ar
On Sat, 19 Jun 2010 11:00:39 +0100
Nicolas Oury wrote:
> There is a bit of arithmetic involved everywhere, and around 2-3 double
> operations per function in the part choosing the instance of rule to apply.
That still sounds arithmetic-heavy to me. In looking through my code,
I find three differ
On Jun 19, 2:24 pm, Mark Engelberg wrote:
> On Sat, Jun 19, 2010 at 12:20 PM, Nicolas Oury wrote:
> > Not "ordinary" code. 10^19 is big.
>
> Nicolas, I think you misunderstand my point. I'm talking about
> loop/recur behavior. If you initialize a loop with the literal 1, and
> then recur with a
Do any of the proposals on the table affect floating point math?
Currently, it seems mildly inconsistent to me that Clojure's numeric
operations are auto-promoting and arbitrary-precision for integers but not
for floats unless you specifically request it with the M suffix. This
probably matters on
On Sat, Jun 19, 2010 at 12:20 PM, Nicolas Oury wrote:
> Not "ordinary" code. 10^19 is big.
Nicolas, I think you misunderstand my point. I'm talking about
loop/recur behavior. If you initialize a loop with the literal 1, and
then recur with a number 2 that's pulled from a collection (and thus
bo
On Jun 19, 3:53 pm, Rich Hickey wrote:
> On Jun 19, 2010, at 6:39 AM, Jules wrote:
>
>
>
>
>
> > I know nothing about the JVM, but I do know that on x86 you can handle
> > fixnum -> bignum promotion fairly cheaply. You compile two versions of
> > the code: one for bignums and one for fixnums. Afte
Not "ordinary" code. 10^19 is big.
On Sat, Jun 19, 2010 at 8:08 PM, Mark Engelberg wrote:
>
> Agreed, but with a default of boxing, it is possible to write all code
> without ever using an annotation -- it will just be a bit slower than
> it could be. With a default of primitives, there is ordin
On Sat, Jun 19, 2010 at 6:32 AM, Rich Hickey wrote:
> Really? It seems tedious to me. Don't you get tired of saying int i = 42 in
> Java, when you know full well the compiler knows 42 is an int? I do, and
> Clojure is competing with languages that infer the right types without the
> redundancy.
On 19 June 2010 17:22, Chas Emerick wrote:
> If you're just looking to run a script that happens to be on the classpath,
> you can do so by prepending an '@' character to the classpath-relative path
> to the script.
>
> So, if a directory foo is on your classpath, and a clojure file you'd like
> t
On 19 June 2010 07:24, rzeze...@gmail.com wrote:
> On Jun 18, 6:15 pm, Paul Moore wrote:
>> I've just seen a couple of postings which, if I'm not mistaken, imply
>> that it's possible to have a Clojure script in my classspath. Is that
>> right?
>
> Yes, you can have .clj files on your classpath.
Thanks to Ryan, Rob and Alex for the suggestions. I'll have a deeper
look into all of them.
Paul
--
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 moderat
On Jun 19, 11:45 am, Rich Hickey wrote:
> On Jun 19, 2010, at 4:25 AM, Daniel wrote:
>
>
>
> > Checked out the new prim branch to repeat some tests.
>
> > user=> (defn ^:static fib ^long [^long n]
> > (if (<= n 1)
> >1
> >(+ (fib (dec n)) (fib (- n 2)
> > #'user/fib
> > user=> (time (
On Jun 19, 2010, at 1:05 PM, Tim Daly wrote:
(proclaim (speed 3) (safety 0))
is verbose? Telling the compiler in one place that you care
about boxing speed, such as (declare (x unboxed)) seems to
me to be a very direct way to tell the compiler to choose
+' vs + everywhere that 'x' occurs.
Th
I'll take a whack at it.
> 1. How come APersistentMap$KeySet doesn't implement IPersistentSet?
Because keys and vals are designed to return (lazy) sequences. More
important, these two functions return those two sequences in the same
order. The laziness avoids having to incur the overhead of cr
(proclaim (speed 3) (safety 0))
is verbose? Telling the compiler in one place that you care
about boxing speed, such as (declare (x unboxed)) seems to
me to be a very direct way to tell the compiler to choose
+' vs + everywhere that 'x' occurs.
This means that "it just works" code does not need
Hi all,
I have run into the following two issues over the last few days. I
would appreciate insight/help/advice:
1. How come APersistentMap$KeySet doesn't implement IPersistentSet?
(clojure.set/intersection (keys {2 "two" 4 "four"}) #{2 3})
java.lang.ClassCastException: clojure.lang.APersiste
On Jun 19, 2010, at 4:25 AM, Daniel wrote:
Checked out the new prim branch to repeat some tests.
user=> (defn ^:static fib ^long [^long n]
(if (<= n 1)
1
(+ (fib (dec n)) (fib (- n 2)
#'user/fib
user=> (time (fib 38))
"Elapsed time: 4383.127343 msecs"
63245986
That's certainly not
Find the Maven plugin in the NB's plugin section and install if you
don't have it. It *might* help. At least that's what fixed it for my
NB installation.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@goog
Yes, exactly it was, also at some point I was trying examples/introduction
(ruby's require like statement) instead of examples.introduction which all
together made me lost. Thanks everybody for your help.
Thanks,
Mohammad
On Sat, Jun 19, 2010 at 11:59 AM, Michael Wood wrote:
> On 19 June 2010
Hello,
I am working with Clojure for a university project and hit this
problem
http://paste.pocoo.org/show/227239/
I am trying to defines symbols from a map with keywords as keys and X
as value (where X is usually a lambda or a Record), the first example
does that ...
(binder data)
Creates the
Checked out the new prim branch to repeat some tests.
user=> (defn ^:static fib ^long [^long n]
(if (<= n 1)
1
(+ (fib (dec n)) (fib (- n 2)
#'user/fib
user=> (time (fib 38))
"Elapsed time: 4383.127343 msecs"
63245986
That's certainly not what I expected
user=> (defn fact [n]
Correction, it worked..
On Fri, Jun 18, 2010 at 6:19 PM, Mohammad Khan wrote:
> No, it didn't work.. what else I could be missing..
>
>
> On Fri, Jun 18, 2010 at 5:56 PM, Rob Lachlan wrote:
>
>> Whoops, that should read:
>>
>> java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure
>> \cloju
If you're just looking to run a script that happens to be on the
classpath, you can do so by prepending an '@' character to the
classpath-relative path to the script.
So, if a directory foo is on your classpath, and a clojure file you'd
like to run is at foo/bar/script.clj, then you can run
On 19 June 2010 17:46, Rob Lachlan wrote:
> I was wondering whether putting a dot in a directory on the classpath
> makes a difference. On OS X, the answer is no. Unfortunately, I
> don't have a windows machine, so I can't check for certain what the
> situation is there.
No, rzezeski found the
The hard error has been restored:
http://github.com/richhickey/clojure/commit/25165a9ccd1001fa7c4725a8219c4108803ae834
Rich
On Jun 19, 2010, at 2:03 AM, Mark Engelberg wrote:
I'm confused. In the latest scheme, what is the eventual plan for
handling a recur to a loop element that was initial
I was wondering whether putting a dot in a directory on the classpath
makes a difference. On OS X, the answer is no. Unfortunately, I
don't have a windows machine, so I can't check for certain what the
situation is there.
Another issue: I ignored case-sensitivity in my answer above. Are
windows
Hi all,
The http://clojure.org/other_libraries web page states that:
"Parallel Processing"
"The parallel library (namespace parallel, in parallel.clj) wraps the
ForkJoin library. This lib is now deprecated."
If the clojure.parallel is deprecated, what replaces it?
Is it pcalls and pvalues in clo
I definitely would like to see more people trying their code with primitive
by default and talk about unexpected bugs and performance improvements.
On Sat, Jun 19, 2010 at 3:43 PM, David Nolen wrote:
>
> "Most real world programs". You mean like Clojure itself?
>
--
You received this message
Jared,
There was another post about issues with netbeans. I am looking into why
this is happening. On another note, labrepl uses clojure 1.2, but that is
all handled via leiningen.
Cheers,
Aaron
On Thu, Jun 17, 2010 at 11:10 PM, Jared wrote:
> I was following the instructions to get labrepl
On Sat, Jun 19, 2010 at 5:13 AM, Mike Meyer <
mwm-keyword-googlegroups.620...@mired.org> wrote:
>
>
> Were those real world programs, or arithmetic benchmarks? Most real world
> programs I see spend so little of their time doing arithmetic that making
> the math an order of magnitude slower wouldn'
Maybe it's only because I'm coming from Ruby, in which number
promotion is automatic and everything is slow, but if I have to choose
between correctness and performance as a *default*, I'll choose
correctness every time. I think there's a good reason that GCC, for
instance, makes you push the compi
On Jun 19, 2010, at 6:41 AM, Heinz N. Gies wrote:
On Jun 19, 2010, at 4:12 , Rich Hickey wrote:
I have to say I'm in the 'pay for what you use' camp - you need a
box, you ask for one. If I don't (and neither do any of those
loops), why should I have to do extra work to avoid it?
- 42
I
On Jun 19, 2010, at 6:39 AM, Jules wrote:
I know nothing about the JVM, but I do know that on x86 you can handle
fixnum -> bignum promotion fairly cheaply. You compile two versions of
the code: one for bignums and one for fixnums. After an arithmetic
instruction in the fixnum code you check if
On Jun 19, 2010, at 2:50 AM, Tim Daly wrote:
Is it possible to follow the Common Lisp convention
of proclaim/declaim/declare in order to specify types?
It would be possible of course, but undesirable. We're trying to avoid
that kind of verbosity.
Rich
--
You received this message becaus
On Jun 19, 2010, at 2:03 AM, Mark Engelberg wrote:
I'm confused. In the latest scheme, what is the eventual plan for
handling a recur to a loop element that was initialized with a
primitive? Are boxed numbers automatically coerced to the primitive?
Would a long be coerced to a double, or doub
On Jun 19, 2010, at 14:55 , Rich Hickey wrote:
>
> Yes, that's a bit Java-ish. All we care about here is returning the canonic
> boxed representation of the number.
It was suggested before that it is simple to allow automatic promotion, by
compiling multiple versions. how about doing this? On
On Jun 18, 2010, at 11:47 PM, dmiller wrote:
Yes, it's easy to imagine a world where people who want efficient
code
have to jump through hoops to get it. OTOH, you can just say (num
some-
expr) to force it to be boxed, if you want assurance of an Object
initializer. Which will be the more c
> I think if we had them, promoting ops
> should be the primed ones, and they would mostly be used in library
Oops, I had meant the non-primed ops should support promotion. But
tbh, I have mixed feelings about promotion.
I haven't required bitint promotion myself, but having statically
typed num
On Jun 19, 2010, at 14:18 , David Powell wrote:
>
> (loop [^int n 1 r 1](if (zero? n) r (recur (dec n) (* r 0.2
>
>
> Numeric literals would still produce primitives where possible, but
> would get auto-boxed in loop initialisers.
>
> I think this option wouldn't have any nasty surprises.
Personally, I have no real interest in bigints, but I'm glad that they
are there, and that arithmetic code supports them polymorphically.
I'm not sure what I think regarding non-promoting numeric operators.
They are ok, but they seem to add complexity to the language, and they
don't look very ne
On 18 June 2010 23:54, Timothy Washington wrote:
> That works, thanks. It's a bit weird because I did try just http encoding
> the parameters before. But I obviously encoded the wrong characters, or
> maybe used the wrong character encoding. Hmmm.
>
> Thanks :)
No problem :)
--
Michael Wood
-
On 19 June 2010 03:33, Rich Hickey wrote:
> Turnabout is fair play, so I've produced a version that swaps the
> defaults, still in the 'equal' branch:
The issue of which behaviour should be the default aside, I think that
I'd expect the *, + etc. ops to go with unannotated literals and the
primed
For such a young language it has a big momentum. Did Scala have that
after 2 years?
On 18 Jun., 23:56, cageface wrote:
> Quick disclaimer - there are a lot of things I like in Scala and I
> think Odersky & crew have done some very impressive work bringing
> functional language concepts to the VM
On Jun 19, 2010, at 4:12 , Rich Hickey wrote:
> I have to say I'm in the 'pay for what you use' camp - you need a box, you
> ask for one. If I don't (and neither do any of those loops), why should I
> have to do extra work to avoid it?
- 42
I totally and wholeheartedly disagree, as long as the
I know nothing about the JVM, but I do know that on x86 you can handle
fixnum -> bignum promotion fairly cheaply. You compile two versions of
the code: one for bignums and one for fixnums. After an arithmetic
instruction in the fixnum code you check if it overflowed, and if it
did you switch to the
yes, when it will be released :-b.
I can describe it though:
it applied a stochastically a set of rewriting rules on trees (represented
by records of records).
To speed up, the activity of the rules in each subtree is cached in a Java
weak hash table from one step to another.
There is a bit of ar
"Nicolas Oury" wrote:
>I tried it on my program. Very few arithmetic, most of it with annotation.
>10%
Can we see the source?
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
T
I tried it on my program. Very few arithmetic, most of it with annotation.
10%.
On an arithmetic benchmark, it would be in te *10/*20 range.
This 10% is orthogonal to what profiling shows. It just makes a lot of
little improvements spread everywhere.
That's why it couldn't be solved with annotation
"Nicolas Oury" wrote:
>On the other hand, having boxed by default is a very significant slowdown
>(10% on the strange program I tried, that had already a lot of annotations,
>probably 20% or more on most programs), that can never be addressed : you
>can't write annotations on every single line o
2010/6/18 Mohammad Khan
> C:\Projects.clj>java -cp
> c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar clojure.main
> Clojure 1.1.0-alpha-SNAPSHOT
> user=> (require 'examples.introduction)
> java.io.FileNotFoundException: Could not locate
> examples/introduction__init.class or example
There is two way to make a domain-specific language with a clojure back-end
:
- if you want the language to be an extension of Clojure, still to be used
in a REPL or by clojure source
-> you write macros. That's what I call embedded. There is a lot of
litterature on Embedded Domain Specific
Hello
Paul Moore at "Sat, 19 Jun 2010 00:08:54 +0100" wrote:
PM> - Build tools: There seem to be things like ant, maven, leiningen. How
PM> do they relate to each other? Is there an "obvious" best answer or
PM> should I be expecting to check them all out depending on my needs? In
PM> that cas
On Sat, Jun 19, 2010 at 3:12 AM, Rich Hickey wrote:
>
> I have to say I'm in the 'pay for what you use' camp - you need a box, you
> ask for one. If I don't (and neither do any of those loops), why should I
> have to do extra work to avoid it?
>
> Rich
>
>
> +1.
It is often very easy to spot int
On 18.06.2010, at 15:31, Nicolas Oury wrote:
> In this situation, I would rather have some kind of toggle
> *use-bigints-by-default* (defaulted to false) used by the compiler.
> Then, if someone needs big integers, he can switch the toggle and recompile
> everything.
> You wouldn't have to chang
Clojure is an amazing piece of work.
I'm interested in Clojure for the concurrency.
I'm also interested in the immutable data structure work.
Someone needs to write a paper about the performance
characteristics of immutable structures when the whole
structure changes. That is, what are the perfo
On 18.06.2010, at 15:20, Rich Hickey wrote:
> Which then begs the questions:
>
> - how will someone 'protect' themselves from libraries written using fastmath?
Using fastmath or not would be part of the library specification. Or, in
general, of the documentation for each individual function. It
81 matches
Mail list logo