Christophe Grand a écrit :
Timothy Pratley a écrit :
I want to grow a tree programmatically so have been trying zippers:
(defn insert-parent [loc n]
(clojure.zip/replace loc (clojure.zip/make-node
loc n loc)))
(println (clojure.zip/root (insert-parent
There is many ways in which you can improve the algorithm. I have seen
flocks of 10,000 birds being rendered real-time on a laptop by Hanno
Hildenbrandt, theoretical biology Utrecht.
http://www.rug.nl/biologie/onderzoek/onderzoekgroepen/theoreticalbiology/peoplePages/hannoPage
Also, Craig
On Jan 26, 1:31 am, Stephen C. Gilardi squee...@mac.com wrote:
The usual way to do this is with (apply str ...)
I just wonder if there is a limit to how long the sequence can be,
because apply should use the Java calling stack, right?
--
Ivan
On Jan 24, 5:31 am, hughw hwink...@gmail.com wrote:
A fellow named Arnold Schwaighofer is hacking in TCO as a thesis
project:
http://mail.openjdk.java.net/pipermail/mlvm-dev/2009-January/000331.html
At first I read his name as Arnold Schwarzenegger. Now that would
be cool! :D
Shawn Hoover wrote:
Why do we have both repeat and replicate? I can sort of keep them straight,
but as they only differ by arity I wonder if they can be combined... or if
I'm missing a subtle reason for separate names. A user in IRC threw out the
possibility of infinite vs. finite functions,
Thanks :)
That works great. I wrote a simple math precedence parser based upon
it:
http://github.com/timothypratley/strive/blob/195c350485a7f01c7ddef01a85d1fd4fc1652fd9/src/clj/math-tree.clj
Test expression [1 + 2 * 3 ^ 4 + 5 * 6]
(+ 1 (* 2 (^ 3 4)) (* 5 6))
Regards,
Tim
I just wonder if there is a limit to how long the sequence can be,
because apply should use the Java calling stack, right?
str is only called once, with many arguments:
user= (apply str (range 1))
Only limit is total memory (like anything).
For the purpose of game development, I think it is a mistake to perform
these calculations for every pair of birds. If you had an error of 1% in
each of the three characteristics (cohesion, alignment, separation) would
that still be good enough? Would this be an acceptable loss if you got a
On Wed, Jan 28, 2009 at 6:59 AM, bOR_ boris.sch...@gmail.com wrote:
There is many ways in which you can improve the algorithm. I have seen
flocks of 10,000 birds being rendered real-time on a laptop by Hanno
Hildenbrandt, theoretical biology Utrecht.
On Jan 27, 8:49 am, MikeM michael.messini...@invista.com wrote:
Were watchers synchronous, they would have to run post-transaction
(else a watcher action failure could cause a transaction rollback,
leaving already notified watchers confused). Being post-transaction
would mean that the
repeat returns an infinite seq; replicate returns a finite one.
On Jan 27, 8:53 pm, Shawn Hoover shawn.hoo...@gmail.com wrote:
Why do we have both repeat and replicate? I can sort of keep them straight,
but as they only differ by arity I wonder if they can be combined... or if
I'm missing a
On Wed, Jan 28, 2009 at 6:36 AM, Albert Cardona sapri...@gmail.com wrot
Shawn Hoover wrote:
Why do we have both repeat and replicate? I can sort of keep them straight,
but as they only differ by arity I wonder if they can be combined... or if
I'm missing a subtle reason for separate names. A
I say go for it. maybe swank could use it for macroexpansions and
stuff. the lack of pretty-print drives me crazy!
On Jan 27, 10:56 am, Mike DeLaurentis delauren...@gmail.com wrote:
Hi,
Is anyone aware of a pretty-print function for Clojure? I saw there
was some discussion about it on this
Agreed ;)
On Wed, Jan 28, 2009 at 9:54 AM, Matt Moriarity matt.moriar...@gmail.comwrote:
I say go for it. maybe swank could use it for macroexpansions and
stuff. the lack of pretty-print drives me crazy!
On Jan 27, 10:56 am, Mike DeLaurentis delauren...@gmail.com wrote:
Hi,
Is anyone
Your manifest assumes your main class lives in the default Java
package, but doesn't it really live in the progs.comex package? Also,
don't you need to use the m switch when you specify a manifest to
the jar command?
Bill
On Jan 27, 10:01 pm, smarf haskell...@gmail.com wrote:
(ns
yes, that is why.
On Jan 27, 9:55 am, Mark Volkmann r.mark.volkm...@gmail.com wrote:
On Mon, Jan 26, 2009 at 8:19 PM, James Reeves
weavejes...@googlemail.com wrote:
On Jan 27, 2:08 am, Mark Volkmann r.mark.volkm...@gmail.com wrote:
Let's see if I've got this straight.
(def foo 1)
On Jan 28, 2009, at 5:00, Eric Lavigne wrote:
In Objective CAML for Scientists [1] pages 92-101 Jon Harrop
demonstrates a rapid numerical solution for a multibody gravitation
problem, which looks similar to the problem you are solving. He
refers to the method as Fast Multipole Method
A couple things:
1. I don't know about embedding jars... Instead, use the Class-Path
manifest attribute to link in clojure.jar.
2. I noticed that your jar command was specifically packaging only
compileexample.class. You need all 4 of those generated classes in the
jar.
-Greg
On Jan 27, 11:01
What are some benefits of allowing two ways of doing the following?
There are two ways to access constants in a Java class.
(. java.util.Calendar APRIL)
java.util.Calendar/APRIL
There are two ways invoke a static method in a Java class.
(. Math pow 2 4)
(Math/pow 2 4)
There are two ways to
Mark Volkmann a écrit :
What are some benefits of allowing two ways of doing the following?
There are two ways to access constants in a Java class.
(. java.util.Calendar APRIL)
java.util.Calendar/APRIL
There are two ways invoke a static method in a Java class.
(. Math pow 2 4)
(Math/pow
I don't know anything about how a bird navigates as part of a flock,
but I guess it uses its eyes to see the other birds. And I also
imagine that it pays more attention to birds nearby than to far away
birds. Maybe it even uses the area covered on its retina by the other
bird to assign to assign
Hello Steve,
I attached file predicates.patch for type and number predicates. Let me
know, if this is an acceptable patch (I haven't worked with them before). We
can then create an issue for Clojure-contrib if necessary.
Shawn, I keep wondering where is the best place to put tests for bug fixes.
Hello,
Do you know if there is a clojure code formatter, written either in clojure
or java ?
It could take a string or InputStream/Reader or File as its input, and
return a well formatted String/outputStream/Writer ?
Indeed, I don't want to reinvent the wheel for clojure-dev, but if it is
On Wednesday 28 January 2009 15:09:26 Konrad Hinsen wrote:
It is possibe to generalize the Fast Multipole Method somewhat, but
it remains a technique for a limited (though important) class of
interactions.
I disagree. The most obvious generalization of FMM (and the one presented in
my books
Hello all!
During writing tests for type predicates, I noticed that these -
possibly useful - predicates are not in clojure.core:
boolean?
character?
regex?
array?
Since this is correct:
user= (= () [])
true
Shouldn't these be also 'true'?
user= (= {} [])
false
user= (= {} #{})
false
user= (=
On Jan 28, 7:09 am, Konrad Hinsen konrad.hin...@laposte.net wrote:
It is possible to generalize the Fast Multipole Method somewhat, but
it remains a technique for a limited (though important) class of
interactions. It is rather unlikely that it will be of any use for
simulating a flock
On Wed, Jan 28, 2009 at 11:18 AM, Frantisek Sodomka fsodo...@gmail.comwrote:
Shawn, I keep wondering where is the best place to put tests for bug fixes.
One way would be to create a separate file (bugs.clj) and put all these
tests there. Another way is to include these tests into their
On Jan 28, 2009, at 18:07, Jon Harrop wrote:
I disagree. The most obvious generalization of FMM (and the one
presented in
my books OCaml for Scientists and F# for Scientists) is the
hierarchical
spatial decomposition of general contributions rather than just
poles. That
I agree that
On Wed, Jan 28, 2009 at 11:13 AM, Frantisek Sodomka fsodo...@gmail.com wrote:
Hello all!
During writing tests for type predicates, I noticed that these -
possibly useful - predicates are not in clojure.core:
boolean?
character?
regex?
array?
I'd also like function? and macro? as an
Are there web pages that provide links to articles and blogs about Clojure?
It would be nice if an Articles link and a Blogs link to such
pages appeared in the upper-right corner of http://clojure.org.
--
R. Mark Volkmann
Object Computing, Inc.
wubbie sunj...@gmail.com writes:
@mire.rooms/*rooms* is new to me.
could anybody explain to me?
Sure thing. *rooms* is a ref in the mire.rooms namespace. So since we
haven't used refer or use to draw all everything from mire.rooms
into the current namespace, we prefix the var with its
Thanks for the replies, everyone. I read in an article that one of the
most common Swing mistakes is putting non-GUI work into the event
dispatch thread, but it seems like oftentimes the cost of creating a
new thread outweighs the benefit of separation, if the work is simple.
With the code above,
Errata: Hanno works in Groningen. As I work in Utrecht, I sort of
automatically appended 'Utrecht' after 'Theoretical Biology'.
Ontopic: There is a thing called Hilbert curves that you could use.
http://en.wikipedia.org/wiki/Hilbert_curve
You could define a 1d array, and translate the bird 2d
On 28 jan, 18:38, Mark Volkmann r.mark.volkm...@gmail.com wrote:
Are there web pages that provide links to articles and blogs about Clojure?
It would be nice if an Articles link and a Blogs link to such
pages appeared in the upper-right corner ofhttp://clojure.org.
Bill Clementson created
The notation mire.rooms/ is new, especially dod(.) and slash(/).
mire.rooms is rooms in ns mire, etc?
-sun
On Jan 28, 12:50 pm, Phil Hagelberg p...@hagelb.org wrote:
wubbie sunj...@gmail.com writes:
@mire.rooms/*rooms* is new to me.
could anybody explain to me?
Sure thing. *rooms* is a
Oh,
I see (ns mire.rooms ... in rooms.clj
Also see (def *rooms* ...)
So we can refer in other name spaces
the vars and functions in this ns?
Like mire.rooms/*rooms*, mire.rooms/*items*,
mire.rooms/make-room etc?
Thanks
-sun
On Jan 28, 1:18 pm, wubbie sunj...@gmail.com wrote:
The notation
Hi Chouser,
Is there anything I can do to help get the proposed change above, or
something like it, included in c.c.command-line? I'd be happy to
modify the patch: removing the somewhat orthogonal alignment code,
etc.
Thanks,
Perry
--~--~-~--~~~---~--~~
You
On Wednesday 28 January 2009 18:09:30 bOR_ wrote:
Errata: Hanno works in Groningen. As I work in Utrecht, I sort of
automatically appended 'Utrecht' after 'Theoretical Biology'.
Ontopic: There is a thing called Hilbert curves that you could use.
http://en.wikipedia.org/wiki/Hilbert_curve
While reading Programming Clojure the other night I found this code
interesting (+), however, when I tried out (-) I got my fingers burnt.
Why this? Or did I do something wrong which has nothing to do with
the code in question?
Emeka
--~--~-~--~~~---~--~~
You
Here's a dumb question, but I can't find it in the docs:
How do I get the length of a sequence? Is there some generic way to
find the number of elements in something that might be list, map, vector
or lazy?
There must be some sort of built in function, or an idiom
Thanks
P
(doc count)
-
clojure.core/count
([coll])
Returns the number of items in the collection. (count nil) returns
0. Also works on strings, arrays, and Java Collections and Maps
nil
On Wed, Jan 28, 2009 at 11:15 AM, Peter Wolf opus...@gmail.com wrote:
Here's a dumb
Hello,
Say I have namespace a.b.c that is defined in file a/b/c.clj, but which also
has some part in file a/b/c1.clj. And that a/b/c.clj loads a/b/c1.clj
somewhere in the code.
If I a.b.c via (compile 'a.b.c), the classes and files are in sync.
If I now make a change in file a/b/c1.clj, how to
Thanks guys! I knew I could 'count' on you ;-)
Chouser wrote:
On Wed, Jan 28, 2009 at 2:15 PM, Peter Wolf opus...@gmail.com wrote:
How do I get the length of a sequence? Is there some generic way to
find the number of elements in something that might be list, map, vector
or lazy?
I'd also like function? and macro? as an alternative to checking the
metadata for :macro set to true.
Forgive my parital answer to the intial query of the thread, but
regarding a function? predicate, it's already included:
user= (doc fn?)
-
clojure.core/fn?
([x])
Laurent PETIT a écrit :
Hello,
Say I have namespace a.b.c that is defined in file a/b/c.clj, but
which also has some part in file a/b/c1.clj. And that a/b/c.clj loads
a/b/c1.clj somewhere in the code.
If I a.b.c via (compile 'a.b.c), the classes and files are in sync.
If I now make a
Hello Christophe,
2009/1/28 Christophe Grand christo...@cgrand.net
Laurent PETIT a écrit :
Hello,
Say I have namespace a.b.c that is defined in file a/b/c.clj, but
which also has some part in file a/b/c1.clj. And that a/b/c.clj loads
a/b/c1.clj somewhere in the code.
If I a.b.c
On Wed, Jan 28, 2009 at 11:13 AM, Frantisek Sodomka fsodo...@gmail.comwrote:
[...]
Since this is correct:
user= (= () [])
true
Shouldn't these be also 'true'?
user= (= {} [])
false
user= (= {} #{})
false
user= (= {} ())
false
user= (= #{} [])
false
user= (= #{} ())
false
Well,
Laurent PETIT a écrit :
Hi Laurent,
Can't you rebind clojure.core/load to record all resources laoded
during
a namespace compilation?
Well yes, that seems indeed a good solution to another problem I'll
have to solve (dependency graph of files) - thanks for anticipation
Talking about equality of:
user= (= [1, 2] '(1, 2))
true
I also wondered if there could be something as strict equal, which
returns true only if both the operands are equal and of the same type.
See JavaScript:
http://www.devguru.com/Technologies/ecmascript/quickref/comparison_operators.html
Currently if you happen upon a Ref in the REPL, you don't get much
helpful information:
user= (ref #{:a 1})
#Ref clojure.lang@968fda
Improving on this is not difficult:
(defmethod print-method clojure.lang.IRef [o w]
(.write w (format #%...@%x: %s
(.getSimpleName
Hello, I have suggestion about clojure.contrib.test-is.
It is useful and sometimes necessary to generate testing data.
Currently, data can be generated by a piece of code and passed to an
'is' function. For example, I want to test for equality of many
things, to see if each is equal to each:
On Wed, Jan 28, 2009 at 4:37 PM, Perry Trolard trol...@gmail.com wrote:
I'd sometimes like to have the exit status from system commands, so I
patched clojure.contrib.shell-out to accept a :verbose option which,
when turned on, returns a map with :exit, :out, :err (where :exit's
value is the
On Wed, Jan 28, 2009 at 4:43 PM, Chouser chou...@gmail.com wrote:
Sounds good. Is ':verbose' the base name for this option?
Sorry for the typo. best name
--Chouser
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
On Wed, Jan 28, 2009 at 4:02 PM, Mark Volkmann
r.mark.volkm...@gmail.com wrote:
Is this the best way to retrieve the employer city?
(reduce get person [:employer :address :city])
That's the definition of 'get-in', but the - suggestion sounds good too.
Is this the best way to get a new map
On Wed, Jan 28, 2009 at 4:36 PM, Stephen C. Gilardi squee...@mac.comwrote:
On Jan 28, 2009, at 10:17 AM, Christian Vest Hansen wrote:
Or replicate could go away.
More likely, I think one of them could take multiple arities and make
the other obsolete.
I like repeat with multiple arities
Hi,
I'm unused to managing file dependencies myself, and I'm lost as to
how to load two namespaces that reference each other.
I'm treating the (use) command as analagous to java's import command.
But I've run into problems trying to load this namespace:
Do I have to resort to manually
Oops, error. Sequence passed to 'are' cannot be evaluated = use
quoted list '( or quoted vector '[ ...
(are (= _1 _2)
'(3 (+ 1 2)
0 (+ -1 1)))
Hm... Since 'are' is basically creating bunch of 'is' tests, I wonder
how to also add a description message for each test. Thinking along
the
On Wed, Jan 28, 2009 at 4:56 PM, Shawn Hoover shawn.hoo...@gmail.com wrote:
On Wed, Jan 28, 2009 at 4:36 PM, Stephen C. Gilardi squee...@mac.com
wrote:
I like repeat with multiple arities and remove replicate.
--Steve
Me too. I'm just waiting for some hammer to drop about args ordering
+1 from me, for what it's worth.
Ditto. Every time I want replicate, I type repeat, remember that it
only takes 1 arg, and then have to search for replicate because the
name just won't stick in my head.
-Jason
--~--~-~--~~~---~--~~
You received this message
On Jan 28, 4:11 pm, Chouser chou...@gmail.com wrote:
Currently if you happen upon a Ref in the REPL, you don't get much
helpful information:
user= (ref #{:a 1})
#Ref clojure.lang@968fda
Improving on this is not difficult:
(defmethod print-method clojure.lang.IRef [o w]
(.write w
On Jan 28, 5:38 pm, Chouser chou...@gmail.com wrote:
On Wed, Jan 28, 2009 at 4:56 PM, Shawn Hoover shawn.hoo...@gmail.com wrote:
On Wed, Jan 28, 2009 at 4:36 PM, Stephen C. Gilardi squee...@mac.com
wrote:
I like repeat with multiple arities and remove replicate.
--Steve
Me too.
On Wed, Jan 28, 2009 at 5:57 PM, Rich Hickey richhic...@gmail.com wrote:
On Jan 28, 4:11 pm, Chouser chou...@gmail.com wrote:
Now Ref and all her cousins print their values:
user= (agent 99)
#ag...@458f41: 99
Patch welcome for this.
Created issue with patch:
I have improved on chouser's gview code (http://blog.n01se.net/?
p=30). It can now expand java.awt.Container objects. I haven't
implemented this, but it would be nice to pass in a function to filter
leaves/nodes.
(defn container? [obj]
(instance? (. (java.awt.Container.) getClass) obj))
(ns
On Jan 29, 6:03 am, janus emekami...@gmail.com wrote:
While reading Programming Clojure the other night I found this code
interesting (+), however, when I tried out (-) I got my fingers burnt.
Why this? Or did I do something wrong which has nothing to do with
the code in question?
You
Thanks for the detailed explanation Steve!
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
Hi,
I see
(add-classpath (str file:// (.getParent (java.io.File. *file*))
/))
in mire.clj.
What value of *file* is it? I failed to see *file* is assigned at all.
-thanks
sun
On Jan 27, 1:16 pm, Phil Hagelberg p...@hagelb.org wrote:
Keith Bennett keithrbenn...@gmail.com writes:
I'm trying
On Wed, Jan 28, 2009 at 1:40 PM, Perry Trolard trol...@gmail.com wrote:
Is there anything I can do to help get the proposed change above, or
something like it, included in c.c.command-line? I'd be happy to
modify the patch: removing the somewhat orthogonal alignment code,
etc.
I've been
Hi,
I saw (.getParent (java.io.File. *file*)) is resolved to parent
directory of current running directory.
java.io.File. is a constructor that takes *file* as an argument, but
I don't see *file* is assgned any value at all.
Is it related to the starup script?
The start-up script has
On Wed, Jan 28, 2009 at 5:24 PM, Christophe Grand christo...@cgrand.net wrote:
Mark Volkmann a écrit :
What are some benefits of allowing two ways of doing the following?
[...]
There are two ways to invoke a constructor to create a Java object.
(def calendar (new GregorianCalendar 2008 3
On Wed, Jan 28, 2009 at 6:52 PM, Laurent PETIT laurent.pe...@gmail.com wrote:
Hello,
Do you know if there is a clojure code formatter, written either in clojure
or java ?
Have a look here:
http://groups.google.com/group/clojure/search?group=clojureq=pretty+printqt_g=Search+this+group
It
Well, I asked this, because I was not sure whether a pretty-print function
is the same as a formatting function.
I thought of the former to have datastructures as its input - thus working
only on well structured code, as the second would accept more raw text,
maybe not totally correct (missing
Thanks Steve and Tim.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
72 matches
Mail list logo