Re: Growing trees

2009-01-28 Thread Christophe Grand
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 (inse

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread bOR_
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 Reynol

Re: Turning a sequence of chars into a string.

2009-01-28 Thread ivant
On Jan 26, 1:31 am, "Stephen C. Gilardi" 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 --~--~-~--~~~---~--~~ You rec

Re: Tail calls in OpenJDK

2009-01-28 Thread ivant
On Jan 24, 5:31 am, hughw 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 --~--~-~--~~---

Re: repeat and replicate

2009-01-28 Thread Albert Cardona
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 function

Re: Growing trees

2009-01-28 Thread Timothy Pratley
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 --~--~-~--~~

Re: Turning a sequence of chars into a string.

2009-01-28 Thread Timothy Pratley
> 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). --~--~-~--~~~---

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread David Nolen
> > 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

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread David Nolen
On Wed, Jan 28, 2009 at 6:59 AM, bOR_ 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. > > > http://www.rug.nl/biologie/onderzoek/onderzoekgroepen/t

Creating executable Jars?

2009-01-28 Thread smarf
(ns progs.comex.compileexample (:gen-class)) (defn -main [] (println (str "Hello " "Sverker" "!"))) (binding [*compile-path* "C:\\clojure\\classes"] (compile 'progs.comex.compileexample)) I compiled C:/clojure/progs/comex/compileexample.clj. I can run the program with: C:\clojure\cl

Re: Agent watchers on Refs

2009-01-28 Thread Rich Hickey
On Jan 27, 8:49 am, MikeM 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 refs could have been cha

Re: repeat and replicate

2009-01-28 Thread Vincent Foley
repeat returns an infinite seq; replicate returns a finite one. On Jan 27, 8:53 pm, 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 sep

Re: repeat and replicate

2009-01-28 Thread Mark Volkmann
On Wed, Jan 28, 2009 at 6:36 AM, Albert Cardona 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 user in IRC

Re: pretty-printing?

2009-01-28 Thread Matt Moriarity
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 wrote: > Hi, > > Is anyone aware of a pretty-print function for Clojure? I saw there > was some discussion about it on this thread a while ago,

Re: pretty-printing?

2009-01-28 Thread David Nolen
Agreed ;) On Wed, Jan 28, 2009 at 9:54 AM, Matt Moriarity wrote: > > 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 wrote: > > Hi, > > > > Is anyone aware of a pretty-print function fo

Re: Creating executable Jars?

2009-01-28 Thread .Bill Smith
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 wrote: > (ns progs.comex.compileexamples >

Re: def vs. intern

2009-01-28 Thread Matt Moriarity
yes, that is why. On Jan 27, 9:55 am, Mark Volkmann wrote: > On Mon, Jan 26, 2009 at 8:19 PM, James Reeves > > > > wrote: > > > On Jan 27, 2:08 am, Mark Volkmann wrote: > >> Let's see if I've got this straight. > > >> (def foo 1) creates a Var in the default namespace with a value of 1. > > >>

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread Konrad Hinsen
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 Met

Re: Creating executable Jars?

2009-01-28 Thread Greg Harman
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 

two way benefits

2009-01-28 Thread Mark Volkmann
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 invo

Re: repeat and replicate

2009-01-28 Thread Christian Vest Hansen
On Wed, Jan 28, 2009 at 3:23 PM, Mark Volkmann wrote: > > On Wed, Jan 28, 2009 at 6:36 AM, Albert Cardona 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 >>

Re: two way benefits

2009-01-28 Thread Christophe Grand
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) > (M

Classloading again

2009-01-28 Thread Ferdinando Villa
Clojure is saving our life and enabling thing we would never have dreamed of without in our ARIES project (http://ecoinformatics.uvm.edu/ aries). Still, we need to hack RT in order to be able to use it. I've seen some discussion on classloader flexibility in the context of Eclipse integration. In

offtopic: code_swarm

2009-01-28 Thread Frantisek Sodomka
I found an interesting project code_swarm (an experiment in organic software visualization), which I would like to share: http://vis.cs.ucdavis.edu/~ogawa/codeswarm/ See video(s): code_swarm - Python http://www.vimeo.com/1093745 Source: http://code.google.com/p/codeswarm/ Enjoy, Frantisek --~--

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread mago
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 i

Re: changes to test_clojure and test_contrib

2009-01-28 Thread Frantisek Sodomka
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. O

Clojure code formatter

2009-01-28 Thread Laurent PETIT
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 writte

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread Jon Harrop
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 book

New functions and possible bugs

2009-01-28 Thread Frantisek Sodomka
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=> (

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread Mark H.
On Jan 28, 7:09 am, Konrad Hinsen 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 of birds. The FMM its

Re: Simple Examples of Concurrency?

2009-01-28 Thread wubbie
@mire.rooms/*rooms* is new to me. could anybody explain to me? -sun (defn- mire-handle-client [in out] (binding [*in* (reader in) *out* (writer out)] ;; bindings doesn't work sequentially, so we need to nest them ;; otherwise the call to read-name uses the old value of *i

Re: changes to test_clojure and test_contrib

2009-01-28 Thread Shawn Hoover
On Wed, Jan 28, 2009 at 11:18 AM, Frantisek Sodomka wrote: > > 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 respective > categori

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread Konrad Hinsen
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

Re: New functions and possible bugs

2009-01-28 Thread Mark Volkmann
On Wed, Jan 28, 2009 at 11:13 AM, Frantisek Sodomka 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 alternative to c

Clojure articles and blogs

2009-01-28 Thread Mark Volkmann
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. --~--~-~--~~~---~-

Re: Clojure articles and blogs

2009-01-28 Thread Nick Vogel
Personally I search for clojure on google blogsearch and then subscribe to that feed to see whenever someone posts something about clojure. On Wed, Jan 28, 2009 at 12:38 PM, Mark Volkmann wrote: > > Are there web pages that provide links to articles and blogs about Clojure? > It would be nice if

Re: Simple Examples of Concurrency?

2009-01-28 Thread Phil Hagelberg
wubbie 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 namespace to refer

Re: Newbie: Trying to write revised multithreaded Swing Celsius converter app

2009-01-28 Thread samppi
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,

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread bOR_
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 po

Re: Clojure articles and blogs

2009-01-28 Thread rb
On 28 jan, 18:38, Mark Volkmann 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 a Yahoo Pipe aggreg

Re: Simple Examples of Concurrency?

2009-01-28 Thread wubbie
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 wrote: > wubbie writes: > > @mire.rooms/*rooms* is new to me. > > could anybody explain to me? > > Sure thing. *rooms* is a ref in the mire.rooms name

Re: Simple Examples of Concurrency?

2009-01-28 Thread wubbie
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 wrote: > The notation mire.rooms/ is new,

Re: clojure.contrib.command-line patch: multiple option format

2009-01-28 Thread Perry Trolard
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 receiv

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread Jon Harrop
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

Learning Clojure

2009-01-28 Thread janus
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 rece

Length of Sequence

2009-01-28 Thread Peter Wolf
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 --~--~-~-

Re: Length of Sequence

2009-01-28 Thread Chouser
On Wed, Jan 28, 2009 at 2:15 PM, Peter Wolf 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? user=> (doc count) - clojure.core/count ([coll]) Returns the

Re: Length of Sequence

2009-01-28 Thread Kevin Downey
(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 wrote: > > Here's a dumb question, but I can

"incremental" (sort of) clojure compilation

2009-01-28 Thread Laurent PETIT
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

Re: Length of Sequence

2009-01-28 Thread Peter Wolf
Thanks guys! I knew I could 'count' on you ;-) Chouser wrote: > On Wed, Jan 28, 2009 at 2:15 PM, Peter Wolf 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? >> > > use

Re: New functions and possible bugs

2009-01-28 Thread Perry Trolard
> 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]) R

Re: "incremental" (sort of) clojure compilation

2009-01-28 Thread Christophe Grand
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 no

Re: "incremental" (sort of) clojure compilation

2009-01-28 Thread Laurent PETIT
Hello Christophe, 2009/1/28 Christophe Grand > > 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

Re: New functions and possible bugs

2009-01-28 Thread Cosmin Stejerean
On Wed, Jan 28, 2009 at 11:13 AM, Frantisek Sodomka wrote: [...] Since this is correct: > user=> (= () []) > true > > Shouldn't these be also 'true'? > user=> (= {} []) > false > user=> (= {} #{}) > false > user=> (= {} ()) > false > user=> (= #{} []) > false > user=> (= #{} ()) > false > Well,

Re: "incremental" (sort of) clojure compilation

2009-01-28 Thread Christophe Grand
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 ant

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread bOR_
Aww. Indeed, if I remember Hanno's talks, he was using meticiously sized cubes that worked well with the cache. by the way, the way to get bird rather than boid/fish swarms is to add gravity, and let the birds bank and roll and pitch and yaw. On Jan 28, 7:46 pm, Jon Harrop wrote: > On Wednesday

Re: New functions and possible bugs

2009-01-28 Thread Frantisek Sodomka
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 h

nested maps

2009-01-28 Thread Mark Volkmann
I have a map that describes a person. It has a key that describes their address. It also has a key for their employer. The employer has its own address. (def person { :name "Mark Volkmann" :address { :street "644 Glen Summit" :city "St. Charles" :state "Missouri" :zip 63304}

more readable IRefs

2009-01-28 Thread Chouser
Currently if you happen upon a Ref in the REPL, you don't get much helpful information: user=> (ref #{:a 1}) # Improving on this is not difficult: (defmethod print-method clojure.lang.IRef [o w] (.write w (format "#<%...@%x: %s>" (.getSimpleName (class o))

test-is: generating and processing testing data

2009-01-28 Thread Frantisek Sodomka
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: (us

Re: nested maps

2009-01-28 Thread Vincent Foley
(-> person :employer :address :city) would be my pick Vincent On Jan 28, 4:02 pm, Mark Volkmann wrote: > I have a map that describes a person. > It has a key that describes their address. > It also has a key for their employer. > The employer has its own address. > > (def person { >   :name "Ma

Re: repeat and replicate

2009-01-28 Thread Stephen C. Gilardi
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 and remove "replicate". --Steve smime.p7s Description: S/MIME cryptograph

proposal for shell-out: option to return articulated out, err, & exit code

2009-01-28 Thread Perry Trolard
Hi Users of Shell-out, 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 exit code int, & :out & :err name either byte arrays

Re: proposal for shell-out: option to return articulated out, err, & exit code

2009-01-28 Thread Chouser
On Wed, Jan 28, 2009 at 4:37 PM, Perry Trolard 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 exit code i

Re: proposal for shell-out: option to return articulated out, err, & exit code

2009-01-28 Thread Chouser
On Wed, Jan 28, 2009 at 4:43 PM, Chouser 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 Groups "Clojure" g

Re: nested maps

2009-01-28 Thread Chouser
On Wed, Jan 28, 2009 at 4:02 PM, Mark Volkmann 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 where the city is chan

Re: Creating executable Jars?

2009-01-28 Thread luciofulci
That's how I managed to create jar: I have folders c:\user\apps and c:\user\apps\classes (which can be empty, but must exist) (beside clojure.jar and other jars) in classpath. I have a file: c:\user\apps\my\hello.clj with this contents: (ns my.hello (:gen-class)) (defn -main [] (println "Hell

Re: repeat and replicate

2009-01-28 Thread Shawn Hoover
On Wed, Jan 28, 2009 at 4:36 PM, Stephen C. Gilardi wrote: > > 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 and

Re: proposal for shell-out: option to return articulated out, err, & exit code

2009-01-28 Thread Perry Trolard
> Sounds good.  Is ':verbose' the best name for this option?  What about > ':return-map'?  I'm okay with ':verbose' if we can't reach consensus > on something else. I agree that :verbose isn't right -- :return-map's not bad at all. Perry --~--~-~--~~~---~--~~ You

Loading two namespaces that :use each other.

2009-01-28 Thread CuppoJava
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 separating

Re: test-is: generating and processing testing data

2009-01-28 Thread Frantisek Sodomka
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 lin

Re: repeat and replicate

2009-01-28 Thread Chouser
On Wed, Jan 28, 2009 at 4:56 PM, Shawn Hoover wrote: > > On Wed, Jan 28, 2009 at 4:36 PM, Stephen C. Gilardi > 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 or > partial applicatio

Re: repeat and replicate

2009-01-28 Thread Jason Wolfe
> +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

Re: more readable IRefs

2009-01-28 Thread Rich Hickey
On Jan 28, 4:11 pm, Chouser wrote: > Currently if you happen upon a Ref in the REPL, you don't get much > helpful information: > > user=> (ref #{:a 1}) > # > > Improving on this is not difficult: > > (defmethod print-method clojure.lang.IRef [o w] > (.write w (format "#<%...@%x: %s>" >

Re: repeat and replicate

2009-01-28 Thread Rich Hickey
On Jan 28, 5:38 pm, Chouser wrote: > On Wed, Jan 28, 2009 at 4:56 PM, Shawn Hoover wrote: > > > On Wed, Jan 28, 2009 at 4:36 PM, Stephen C. Gilardi > > wrote: > > >> I like "repeat" with multiple arities and remove "replicate". > >> --Steve > > > Me too. I'm just waiting for some hammer to dr

Re: more readable IRefs

2009-01-28 Thread Timothy Pratley
Great! That's really handy. --~--~-~--~~~---~--~~ 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 clojure+unsubsc

Re: Length of Sequence

2009-01-28 Thread Rich Hickey
On Jan 28, 2:19 pm, Chouser wrote: > On Wed, Jan 28, 2009 at 2:15 PM, Peter Wolf 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? > > user=> (doc count) >

Re: pretty-printing?

2009-01-28 Thread Tom Faulhaber
Yeah, I'll probably layer a pretty printer on top of my common lisp format stuff sometime in the next month. I'm just just doing some cleanup to cl-format to make it a tad more user friendly right now and then I'll dig in on the pretty printing stuff. I don't know if I'll go for the all out XP ap

Re: Length of Sequence

2009-01-28 Thread Peter Wolf
How about this? Needlessly wordy to make it more search-able... clojure.core/count ([coll]) Returns the length of a list or vector, the number of keys in a map, the size of a string, or the number of items in a sequence or collection. (count nil) returns 0. Also works on Java Collections a

Re: more readable IRefs

2009-01-28 Thread Chouser
On Wed, Jan 28, 2009 at 5:57 PM, Rich Hickey wrote: > > On Jan 28, 4:11 pm, Chouser wrote: >> >> Now Ref and all her cousins print their values: >> >> user=> (agent 99) >> # > > Patch welcome for this. Created issue with patch: http://code.google.com/p/clojure/issues/detail?id=56 --Chouser -

Re: "incremental" (sort of) clojure compilation

2009-01-28 Thread Laurent PETIT
I tried this, but it didn't seem to work : ; a/b/c.clj (ns a.b.c) (defn f [] :f) (load "c1") ;a/b/c1.clj (in-ns 'a.b.c) (defn g [] :g) ;in REPL user=>(let [real-load clojure.core/load] (binding [clojure.core/load (fn [f] (println "file loaded: " f) (real-load f))] (compile 'a.b.c))) file loaded

Re: repeat and replicate

2009-01-28 Thread Timothy Pratley
> Patch welcome for this. http://code.google.com/p/clojure/issues/detail?id=55&colspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To p

improved gview

2009-01-28 Thread kyle smith
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

Re: Learning Clojure

2009-01-28 Thread Timothy Pratley
On Jan 29, 6:03 am, janus 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 didn't do anything wro

Re: Learning Clojure

2009-01-28 Thread Stephen C. Gilardi
On Jan 28, 2009, at 6:48 PM, Timothy Pratley wrote: You didn't do anything wrong, there is a definition of + with no arguments which just returns 0, but no definition of - with no arguments. Similarly (*) is defined as 1, but (/) is undefined. I guess there is no such thing as negative 0, then

Re: Learning Clojure

2009-01-28 Thread Timothy Pratley
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

Re: Simple Examples of Concurrency?

2009-01-28 Thread wubbie
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 wrote: > Keith Bennett writes: > > I'm trying to wrap my head around Clojure's

Re: clojure.contrib.command-line patch: multiple option format

2009-01-28 Thread Chouser
On Wed, Jan 28, 2009 at 1:40 PM, Perry Trolard 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 conflicted over

Re: test-is: generating and processing testing data

2009-01-28 Thread Stuart Sierra
Hi Frantisek, I think I understand what you're looking for here, but I don't see how to make it work. If "are" could be applied to a generated list, then it would have to evaluate its arguments, which is a pretty fishy thing for a macro to do. (But possible -- check out clojure.contrib.apply- mac

How come *file* is assigned to current (running) dir?

2009-01-28 Thread wubbie
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 clojure.ma

Re: two way benefits

2009-01-28 Thread Michael Wood
On Wed, Jan 28, 2009 at 5:24 PM, Christophe Grand 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 16)) >> (def c

Re: Clojure code formatter

2009-01-28 Thread Michael Wood
On Wed, Jan 28, 2009 at 6:52 PM, Laurent PETIT 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=clojure&q=pretty+print&qt_g=Search+this+group > It could take a string

Re: Clojure code formatter

2009-01-28 Thread Laurent PETIT
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 p

Re: Learning Clojure

2009-01-28 Thread Emeka
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 clojure+unsubscr...@g