To me, numbers are an abstraction, just as sequences are an abstraction.
Because Clojure treats sequences as abstractions, I can say (partition 3
(set '(1 2 3 4 5 6))) without Clojure complaining that sets are not the kind
of thing that can be efficiently partitioned. Sets are seqable, so they can
If you're going to give example of what the current branch is like, at least
write the code how a primitive Clojurian would write it:
(let [n (long 9223372036854775810)]
(* (/ n 3) 3))
; Value out of range for long: 9223372036854775810
(let [n (long 9223372036854775810)]
(* (/ n 2) 2))
; Valu
Hi,
On Jun 22, 4:55 am, Base wrote:
> [
> {:data A1
> :children [{:data B1 :children [{:data C1} {:data C2}]]}
> {:data B2 :children [{:data C3} {:data C4}]]}
>
> {:data A2
> :children [{:data B3 :children [{:data C5} {:data C6}]]}
>
Hi,
On Jun 22, 7:47 am, David Nolen wrote:
> Clearly a range' is in order.
Eh? Why? The following is probably completely hypothetical syntax,
because I'm not familiar with the changes in the numeric branches. But
I think, it's easy to get my point.
(defn range
([^long lower ^long upper] work
I took a crack at it. Whenever I think of building up a structure, I
think of reduce or into. Like Meikel, I create a nested, sorted-map
tree first, then convert to the vector-of-maps format you describe.
(defn add-path [root path]
(let [add-child (fn [parent child-path]
(if
pleone wrote:
Mistake there is no error
Alas! The Internet never forgets ;)
Regards,
BG
--
Baishampayan Ghose
oCricket.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 po
On Jun 22, 2010, at 7:47 , David Nolen wrote:
> If you're going to give example of what the current branch is like, at least
> write the code how a primitive Clojurian would write it:
> ...
I feel his examples were on purpose not given as a 'primitive' clojurian or a
'boxing' one would write th
I'd like to ask something, is there an (open source) project that really got a
speed boost from the move to primitive +,- & Co. and is testable /
benchmarkable fairly easy? I sadly don't have any of those :( to do it all on
my own.
I'm not asking to mock, what I'd like to do (for myself) is loo
++1 for auto promotion, average code
is complex enough, lets not add
more incertainty with overflow
exceptions.
Data changes overtime and
discovering it in production with
an overflow exception is less than
elegant.
Degraded performance is much more
acceptable in production than a crash
over an
On Tue, Jun 22, 2010 at 12:45 PM, Luc Préfontaine <
lprefonta...@softaddicts.ca> wrote:
>
> Data changes overtime and
> discovering it in production with
> an overflow exception is less than
> elegant.
>
> Degraded performance is much more
> acceptable in production than a crash
> over an unhandle
Boxing and unboxing can be very confusing.
The "rules" need to be clearly stated somewhere.
It might help if we introduced an explicit syntax,
which might compile away, such as:
(box i)
(unbox i)
(with-unboxed [i 7] ...)
etc. I know Rich doesn't like "syntactic overhead"
but source languages a
On Tue, Jun 22, 2010 at 6:04 AM, Heinz N. Gies wrote:
>
> > Yes. With Rich's primitive work we can get to *1 billion arithmetic
> operations* in < 2/3 of a second on commodity hardware.
>
> Which is absolutely great since I always wanted to do that :P ,
> meaning the example is kind of far fetche
Thank you all for your help. This helps so much!
I did try using into a number of times, but didnt get that to work. I
have to admit that, except for the rudamentary examples I have not
used reduce too much yet. I was reviewing Stu Halloways code on group-
by and was trying to come up with a wa
If the maintenance cost of
keeping both options in the Clojure run
time is reasonnable it's fine with me.
Rich is the best person to answer this.
Otherwise, auto promotion should be
the winner... And the default ...
The vast majority of apps these days
are not gravitating around high
performanc
>
> Lets just make things easy for the
> average guy..,
>
If we base the decision on the average guy not writing high performance
numeric apps, then we should also base it on the fact that he does not need
more than a long in 99% of cases either as Rich points out. And longs are a
much simpler con
On Tue, Jun 22, 2010 at 2:00 PM, Daniel Gagnon wrote:
> If we base the decision on the average guy not writing high performance
> numeric apps, then we should also base it on the fact that he does not need
> more than a long in 99% of cases either as Rich points out. And longs are a
> much simple
On 21 June 2010 22:12, Russ Olsen wrote:
> Paul,
>
> One way would be to use the cljw.exe that comes with
> dejour. This is a windows executable that runs clojure
> without creating that annoying extra window.
Thanks. That's certainly one option - I could probably without too
much difficulty put
On 6/21/10 8:07 AM, Joost wrote (shown here as corrected in a 2nd msg):
For core swank-clojure (without the elisp parts), you start a swank
server somewhere (using leiningen or some other script) and connect to
that using slime-connect. This means you need to install swank-
clojure in your clojur
On 6/21/10 5:31 AM, patrik karlin wrote:
Hello theres a wherry "spartan" screencast on vimeo that install all this with
regular emacshttp://vimeo.com/11844368
Thanks. I'm going to try Joost's advice first and, if that doesn't
work, I'll study your screencasts -- adapting them to Aquamacs if
On 22 June 2010 00:11, Rick Moynihan wrote:
> On 21 June 2010 18:42, Paul Moore wrote:
>> 3. Using a bat file to start a GUI application from Explorer causes an
>> unnecessary and ugly console window to appear.
>
> You should use "javaw" instead of "java" to start the JVM without the
> console wi
(defn fn1 [a] (fn2 a) )
When is a cleared, before call to fn2 or after?
--
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 be patient w
On Jun 22, 3:00 pm, Daniel Gagnon wrote:
> > Lets just make things easy for the
> > average guy..,
>
> If we base the decision on the average guy not writing high performance
> numeric apps, then we should also base it on the fact that he does not need
> more than a long in 99% of cases either as
On Jun 22, 7:36 am, Larry Travis wrote:
>
> Thanks. I'm not sure what you mean by "leiningen" or by a "clojure
> project" (which almost certainly reveals my inexperience with respect to
> clojure installation and/or programming!) but I think I can figure it
> out with some exploration.
Leinging
I never said we should not provides ways to tune code and get higher throughput
or arbitrary sized numbers. There has to be a path to satisfies those needs.
The stuff that was proposed on this thread (specialized ops, ...) should allow
people to tune their code if they require to do so.
I said tha
The clojure-contrib build is failing with a stack trace that seems to be
entirely within Hudson. Anybody know what this might be?
http://build.clojure.org/job/clojure-contrib/148/console
Stu
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post t
All of this talk about the "average guy" is ungrounded. Average over what set
and how are you getting the data? It may (or may not) be true that that the
average *programmer* understands that big numbers (how big?) are something
special, but IMHO that (if true) would probably be because the ave
On Jun 22, 2010, at 12:44 AM, Mark Engelberg wrote:
The new uber-loop is fantastic.
So I guess the main point still to be finalized is whether the default
arithmetic ops will auto-promote or error when long addition
overflows.
Playing around with the latest equals branch:
user=> (def n 92233
On Tue, Jun 22, 2010 at 5:08 AM, Paul Moore wrote:
> On 22 June 2010 00:11, Rick Moynihan wrote:
>> On 21 June 2010 18:42, Paul Moore wrote:
>>> 3. Using a bat file to start a GUI application from Explorer causes an
>>> unnecessary and ugly console window to appear.
>>
>> You should use "javaw"
On Tue, Jun 22, 2010 at 10:15 AM, Lars Nilsson wrote:
> On Tue, Jun 22, 2010 at 5:08 AM, Paul Moore wrote:
>> On 22 June 2010 00:11, Rick Moynihan wrote:
>>> On 21 June 2010 18:42, Paul Moore wrote:
3. Using a bat file to start a GUI application from Explorer causes an
unnecessary and
Seems to be worth a try. I wonder how well it would do? It looks like
neither Scala nor JRuby have won this before.
Here are the guidelines, if someone wants to give it a try:
"500-word description of product/technology/innovation being
nominated. Please emphasize the role of Java technology in m
As the implementor Rich, it's your
call as I said :))
If auto promotion brings in chaos
then lets drop it entirely.
If people want to eat elephants they can still choose to use directly
big number
implementations.
Luc P
Sent from my iPod
On 2010-06-22, at 10:46 AM, Rich Hickey wrote:
--
On Tue, 22 Jun 2010 14:34:44 +0100
Nicolas Oury wrote:
> On Tue, Jun 22, 2010 at 2:00 PM, Daniel Gagnon wrote:
>
> > If we base the decision on the average guy not writing high performance
> > numeric apps, then we should also base it on the fact that he does not need
> > more than a long in 99
There are places where "regular" folks can be helped (e.g. perhaps
supporting contagious bigs for the normal/fast ops so that the
potentially foreign op-prime notation can be ignored if that's
desirable), but handicapping capability or semantics in any direction
based on vague appeals to "a
One of our reviewers made a fantastic comment on the book and I
thought I would share it for public consumption:
"I know that you Lisp guys are incredibly proud of arbitrary-precision
arithmetic, but I can't help but think that it is entirely missing the
point: infinite precision is infinitely slo
On 22 June 2010 15:15, Lars Nilsson wrote:
> Maybe Windows Script Host is an option, if you haven't looked at that one yet.
Yes, WSH/VBS is a reasonable option. There are some gotchas which you
need to be careful of though - there's *still* only one filetype
(.vbs) which is executed by cscript o
> Everyone has to realize the math you are advocating for the default, on
> non-tagged architectures like the JVM and CLR, *must* do an allocation on
> every +/-/* etc operation. And such ops are littered throughout non-numeric
> data structure code, for indexes, offsets, bounds etc. Allocating on
We always talk about auto promoting ops, is there a way, and I guess the answer
will be no, to have auto demoting ops? as in they get (+ (num 1) (num 1)) and
return (long 2) if the calling side desires so? As in the function promises to
return a Number or better.
I know this might die on the fa
On Mon, 21 Jun 2010 21:44:04 -0700
Mark Engelberg wrote:
> The new uber-loop is fantastic.
>
> So I guess the main point still to be finalized is whether the default
> arithmetic ops will auto-promote or error when long addition
> overflows.
I think calling them "default" gives the wrong idea h
On Tue, Jun 22, 2010 at 7:46 AM, Rich Hickey wrote:
> It is precisely for these reasons that the first iteration was based upon
> BigInteger contagion.
Yeah, I still don't like BigInteger contagion, and I believe I would
vastly prefer the current equals branch, even with its idiosyncrasies,
versu
We could always take the FORTRAN approach and make
identifiers that start with I through N default to
contagious behavior :-)
Rich Hickey wrote:
On Jun 22, 2010, at 12:44 AM, Mark Engelberg wrote:
The new uber-loop is fantastic.
So I guess the main point still to be finalized is whether the
On Tue, 22 Jun 2010 10:46:05 -0400
Rich Hickey wrote:
> ---
> The claim that this primitive stuff is just for numeric-intensive
> applications is outrageous and false, and ignores the implementation
> of Clojure itself to an embarrassing degree. I've worked my tail off
> to reduce th
On Tue, Jun 22, 2010 at 6:43 PM, Mike Meyer <
mwm-keyword-googlegroups.620...@mired.org> wrote:
>
> > Everyone has to realize the math you are advocating for the default,
> > on non-tagged architectures like the JVM and CLR, *must* do an
> > allocation on every +/-/* etc operation. And such ops ar
On Tue, 22 Jun 2010 18:56:30 +0100
Nicolas Oury wrote:
> On Tue, Jun 22, 2010 at 6:43 PM, Mike Meyer <
> mwm-keyword-googlegroups.620...@mired.org> wrote:
>
> >
> > > Everyone has to realize the math you are advocating for the default,
> > > on non-tagged architectures like the JVM and CLR, *mus
On Tue, Jun 22, 2010 at 10:43 AM, Mike Meyer
wrote:
> Would it be Clojure if it didn't run on the JVM? Personally, I could
> live without the JVM. And the more I learn about the JVM, the more I
> could live without it!
For my work, languages are only useful if they run on the JVM *and*
can intero
On Tue, Jun 22, 2010 at 1:43 PM, Mike Meyer
wrote:
> Would it be Clojure if it didn't run on the JVM? Personally, I could
> live without the JVM. And the more I learn about the JVM, the more I
> could live without it!
I just want to add my two cents here. I don't think we would've ever used
cloju
Picky syntax question:
In common lisp cond requires more parenthesization than clojure:
(cond
((evenp a) a);if a is even return a
((> a 7) (/ a 2));else if a is bigger than 7 return a/2
((< a 5) (- a 1));else if a is smaller than 5 return a-1
(t 17))
vs clojure:
(con
Actually, being a common-lisper I end up re-keying my clojure
cond expressions every time. Either I end up putting the extra
levels of parens or I forget to properly "even-count".
Emacs paren-bouncing makes it easy to syntax check a common
lisp cond but fails badly with clojure cond. Emacs doesn'
On Tue, Jun 22, 2010 at 4:27 PM, cageface wrote:
>
> Any thoughts on this or other approaches?
(defn compare-row [a b]
;; compare null rows as > to advance
cursor
(cond
(and (nil? a) (nil? b)) [0,0]
(and (nil? a) (not= b nil)) [1, 0]
(and (not= a nil) (nil? b)) [-1, 0]
tru
On Jun 22, 2010, at 3:27 PM, cageface wrote:
> In this case it takes some visual parsing to see what the predicates
> and results are and if you break them up onto individual lines you
> have to count evens to figure out what the results are. The extra
> level of indentation in the CL case makes i
This is fine when you just have simple clauses like this, but what if
the clauses are more complex, even containing subclauses?
A quick scan through clojure contrib suggest that people are inserting
blank lines between clauses when they get more complex. I guess this
is idiomatic for clojure?
On
This looks nice but requires more hand-indenting, right? I really like
being able to select a block in emacs and hit indent-region and get
predictably tidy code. (The failure of emacs to do this 100% with
scala code is a pet peeve).
On Jun 22, 1:50 pm, Michael Gardner wrote:
> Try this:
>
> (defn
On Jun 22, 2010, at 3:55 PM, cageface wrote:
> This looks nice but requires more hand-indenting, right? I really like
> being able to select a block in emacs and hit indent-region and get
> predictably tidy code. (The failure of emacs to do this 100% with
> scala code is a pet peeve).
Can't help
> (cond
>(even? a) a ;if a is even return a
>(> a 7) (/ a 2) ;else if a is bigger than 7 return a/2
>(< a 5) (- a 1) ;else if a is smaller than 5 return a-1
>t 17)
I tend to write the condition and action on separate lines, and put a
blank comment in between each, like
While traversing the data structure both prewalk and postwalk remove
all the metadata:
user=> (require '[clojure.walk :as w])
nil
user=> (def data {:a ^{:a :this-is-a} [1 2 3]})
#'user/data
user=> (meta (:a data))
{:a :this-is-a}
user=> (meta (:a (w/postwalk identity data)))
nil
user=> (meta (:a (
user=> (in-ns 'protocol.test)
#
protocol.test=> (defrecord person [name age])
protocol.test.person
protocol.test=> (person. "bobby" 23)
#:protocol.test.person{:name "bobby", :age 23}
protocol.test=> (in-ns 'user)
#
user=> (protocol.test/person. "alice" 2)
java.lang.IllegalArgumentException: Unable
Hi,
On 22 Jun., 22:27, cageface wrote:
> Picky syntax question:
>[...]
I don't consider this picky. Many of Clojures differences to older
lisps are well-grounded. To me the removal of extra parens in cond is
not. During my time with Clojure I experienced this as a little
nuisance. Little bec
hello,
2010/6/22 Brent Millare :
> user=> (in-ns 'protocol.test)
> #
> protocol.test=> (defrecord person [name age])
> protocol.test.person
> protocol.test=> (person. "bobby" 23)
> #:protocol.test.person{:name "bobby", :age 23}
> protocol.test=> (in-ns 'user)
> #
> user=> (protocol.test/person. "a
2010/6/22 Stefan Kamphausen :
> The indentation Emacs chooses when hitting M-q on an opening paren (or
> when indenting a region using some other magic) is law in my opinion.
emacs bending your mind as nauseum :-)
--
You received this message because you are subscribed to the Google
Groups "Cloj
I think I'm going to take this route. The style seems pretty common in
clojure contrib and it's readable, if a bit odd at first.
On Jun 22, 2:20 pm, David Powell wrote:
> I tend to write the condition and action on separate lines, and put a
> blank comment in between each, like this:
--
You rec
Hi Laurent,
You're right, there is no such thing as a "class defined in a
namespace", I meant to ask instead, defines a var, which still would
not be correct. Referring to the record as protocol.test.person
worked. Thanks.
-Brent
On Jun 22, 6:07 pm, Laurent PETIT wrote:
> hello,
>
> 2010/6/22 B
user=> (ns utils)
utils=> (ns-unmap 'utils 'cond)
utils=> (defmacro cond [& body] `(clojure.core/cond ~@(apply concat body)))
#'utils/cond
utils=> (macroexpand-1 '(cond (false "false") (true "true")))
(clojure.core/cond false "false" true "true")
utils=> (cond
(false "false")
I think the following function does what you want (I've also published
it @ http://gist.github.com/449266 if you find Gists prettier):
(defn munge [vs]
(if (== 1 (count (first vs)))
(reduce into vs)
(let [gs (group-by #(% 0) vs)]
(map (fn [k v]
{:data k :children v})
On Tue, Jun 22, 2010 at 4:42 PM, rob levy wrote:
> user=> (ns utils)
> utils=> (ns-unmap 'utils 'cond)
> utils=> (defmacro cond [& body] `(clojure.core/cond ~@(apply concat body)))
> #'utils/cond
> utils=> (macroexpand-1 '(cond (false "false") (true "true")))
> (clojure.core/cond false "false" tru
On Jun 22, 1:27 pm, David Nolen wrote:
> On Tue, Jun 22, 2010 at 6:04 AM, Heinz N. Gies wrote:
>
>
>
> > > Yes. With Rich's primitive work we can get to *1 billion arithmetic
> > operations* in < 2/3 of a second on commodity hardware.
>
> > Which is absolutely great since I always wanted to do th
Greetings,
I've recently started learning Clojure. For the past year or so I've
been using CouchDB, and am very happy with the MVCC disk storage
system it uses. Has anyone tried marrying the two system systems to
create a truly persistent data primitive where any "updates" to a map
is written to t
On 18 Giu, 16:52, rob levy wrote:
> As an informal survey of people who use both Clojure and Common Lisp for
> different projects, what do you see as the main determining factors behind
> your choice to use either Clojure or Common Lisp for a project, given the
> present state of Clojure. Let's o
Hello Folks,
I'm a noob to both programming (1 year part-time) and to Clojure (1
week).
I am unclear on how I can call an Ifn stored in a map usefully
and I am hoping you can help me.
I have stored data in a few maps (both functions and data):
user=> (def uhoh* (ref {:event {:date #(date
>
>user=>(def current* (merge (uhoh* :event)(why* :event)))
>#'user/current*
>
> here's my problem:
>
>user=> current*
>{:stuff "ELI", :date #user$fn__2...@4fa3551c>, :name "EOW"}
>
> I was hoping this kind of a call would yield:
>
> {:stuff "ELI", :date "Tue 22 Jun 2010 17:
I'm just one voice on the side that's been advocating for auto-promotion by
default. For what it's worth, I completely see where the other side is
coming from, and if Rich sees primitive math by default as important to
Clojure's future, then so be it. It sounds like he's given it a lot of
though an
Firstly, consider using Delays rather than IFn. See (doc delay) and
(doc delay?). In Clojure, many sorts of things are IFns, including
(among others) sets, vectors and maps, and you probably don't want to
call those.
(def uhoh* (ref {:event {:date (delay (java.util.Date.)) :name "EOW"}}))
(def why
On Tue, 22 Jun 2010 21:07:39 -0400
Garth Sheldon-Coulson wrote:
> I would, however, like to throw some support behind Mike Meyer's suggestion
> that the arbitrary precision numeric tower use names like add, sub, mul,
> div, inc, dec, while the "default" ops keep the symbolic names. I think it
> w
Before.
On Jun 22, 3:46 am, ann wrote:
> (defn fn1 [a] (fn2 a) )
>
> When is a cleared, before call to fn2 or after?
--
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 n
I do not understand the question.
On Jun 22, 5:46 am, ann wrote:
> (defn fn1 [a] (fn2 a) )
>
> When is a cleared, before call to fn2 or after?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.
It's an issue of when the object referenced by 'a' can be garbage
collected.
Rich is able to do some magic in the bytecode whereby the 'a'
reference is set to null prior to the effective call to fn2 (and still
pass the object), thus the object can be garbage collected whenever
fn2 is done with it
74 matches
Mail list logo