Re: Turning a sequence of chars into a string.

2009-02-01 Thread Meikel Brandmeyer
Hi, Am 01.02.2009 um 12:26 schrieb ivant: Right. What I meant is, that some systems have a limit on the number of parameters. I don't know if JVM has such limit (besides total memory) or not. I think there is upper limit of what is defined in Clojure. For apply there is applyTo in IFn. Whic

Restarting a transaction with commute?

2009-02-01 Thread Paul Barry
My understanding of commute is that it would not restart the transaction, it would just apply the function. So I wrote this little test program: (defmacro in-thread [& body] `(.start (Thread. (fn [] (println "Thread" (.getId (Thread/currentThread)) " started") ~...@body

naming consistency

2009-02-01 Thread Mark Volkmann
I noticed that some multi-word functions separate the words with a hyphen while others don't. For example, butlast and drop-last. Surely changing names of core functions now would break lots of code, but I wonder if it would still be worthwhile in the long run to do this before 1.0 is released. -

Re: meaning of coll

2009-02-01 Thread e
i was confused by the meaning of coll, too . . .even at a more basic level of not knowing that it meant collection. I even thought at first I was seeing "col1" or that the second lower('L') was a capitol(i). I read it as, "column one" in my head. Is it accurate to call it "some-seq" or something?

loop bug?

2009-02-01 Thread Jan Rychter
"loop is exactly like let, except that it establishes a recursion point at the top of the loop, with arity equal to the number of bindings. See recur." (let [[a b] [1 2]] [a b]) => [1 2] (as expected) However: (loop [[a b] [1 2]] (if (= a 2) true (recur [(+ a 1) (+

Re: loop bug?

2009-02-01 Thread James Reeves
On Feb 1, 1:27 pm, Jan Rychter wrote: >   (loop [[a b] [1 2]] >     (if (= a 2) >       true >       (recur [(+ a 1) (+ b 1)]))) > >   java.lang.NoClassDefFoundError: clojure/core$loop__4287$fn__4289 > (NO_SOURCE_FILE:1) >     [Thrown class clojure.lang.Compiler$CompilerException] It works for

Re: Turning a sequence of chars into a string.

2009-02-01 Thread Jason Wolfe
On Jan 28, 4:14 am, ivant wrote: > 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? Coming from CL I was surpr

Re: loop bug?

2009-02-01 Thread Meikel Brandmeyer
Hi, Am 01.02.2009 um 14:27 schrieb Jan Rychter: (loop [[a b] [1 2]] (if (= a 2) true (recur [(+ a 1) (+ b 1)]))) 1:1 user=> (loop [[a b] [1 2]] (if (= a 2) true (recur [(+ a 1) (+ b 1)]))) true java.lang.NoClassDefFoundError: clojure/co

Re: what does -> mean?

2009-02-01 Thread Mark Volkmann
On Sun, Feb 1, 2009 at 8:14 AM, Adrian Cuthbertson wrote: > > I would say "thread" is used here colloquially - i.e. "works the expr > through the forms" and "form" is as defined in clojure.org/reader. Well ... not really. There is no place on that page that says anything like "A form is ...". It

Re: what does -> mean?

2009-02-01 Thread e
I was able to work through the first two examples, and thanks for those. I will have to study maps more, I guess, to understand the last one. I don't know where 'x' came from: > > user=> (-> x :one :b) > 2 > > --~--~-~--~~~---~--~~ You received this message becau

Re: what does -> mean?

2009-02-01 Thread e
is there a definition of "thread" somewhere, and a definition of "form" somewhere? Thanks. On Sat, Jan 31, 2009 at 10:31 PM, Jason Wolfe wrote: > > On Jan 31, 7:09 pm, wubbie wrote: > > Hi, > > > > I saw in ants.clj a notation (->). > > what is it? > > For example, > > (defn place [[x y]] > >

Re: what does -> mean?

2009-02-01 Thread Adrian Cuthbertson
Sorry! That should have read; (-> m :one :b) 2 On Sun, Feb 1, 2009 at 5:13 PM, e wrote: > I was able to work through the first two examples, and thanks for those. I > will have to study maps more, I guess, to understand the last one. I don't > know where 'x' came from: >> >> user=> (-> x :one

Re: what does -> mean?

2009-02-01 Thread Adrian Cuthbertson
I would say "thread" is used here colloquially - i.e. "works the expr through the forms" and "form" is as defined in clojure.org/reader. On Sun, Feb 1, 2009 at 4:01 PM, e wrote: > is there a definition of "thread" somewhere, and a definition of "form" > somewhere? > > Thanks. > > On Sat, Jan 31,

Re: Restarting a transaction with commute?

2009-02-01 Thread Rich Hickey
On Feb 1, 2009, at 6:47 AM, Paul Barry wrote: > My understanding of commute is that it would not restart the > transaction, it would just apply the function. So I wrote this > little test program: > > (defmacro in-thread [& body] > `(.start > (Thread. > (fn [] >(println "

Re: newbie Q: can I optimize away like this?

2009-02-01 Thread Chouser
On Sat, Jan 31, 2009 at 8:01 AM, wubbie wrote: > > Hello, > I'd like to separate dosync and other funcs as follows. > Any comment? Essentially I want to allow more concurrency. > > (if true > (do > (dosync (ref-set r1 1)) > (non-ref setting fun)) > (else-fun)) > > Instead of > (if

Re: Turning a sequence of chars into a string.

2009-02-01 Thread ivant
On Jan 28, 3:19 pm, Timothy Pratley wrote: > > 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 a

Re: loop bug?

2009-02-01 Thread Jan Rychter
Meikel Brandmeyer writes: > Am 01.02.2009 um 14:27 schrieb Jan Rychter: > >> (loop [[a b] [1 2]] >>(if (= a 2) >> true >> (recur [(+ a 1) (+ b 1)]))) > > 1:1 user=> (loop [[a b] [1 2]] > (if (= a 2) >true >(recur [(+ a 1) (+ b 1)]))) > tr

a question about binding

2009-02-01 Thread Eric
I recently wrote on my blog that using #' was a good way to make sure that you get the function definition you want despite the symbol being rebound within a let. For instance: (let [list 10] (#'list 1 2 3)) => (1 2 3) cgrand responded (here: http://www.reddit.com/r/programming/comments/7tn

Re: Request for feature: watchers on namespaces

2009-02-01 Thread Chouser
On Sun, Feb 1, 2009 at 1:13 AM, falcon wrote: > > +1 for this request. I have a question as well, aren't the namespace > bindings stored in one of clojure's concurrency objects? Namespace mappings and aliases are each currently stored in a java.util.concurrent.atomic.AtomicReference Since Cloj

Re: a question about binding

2009-02-01 Thread Stephen C. Gilardi
On Feb 1, 2009, at 12:04 PM, Eric wrote: So, my question is this: what is the difference/relationship between #' and the fully-qualified name? #'x is a sequence of characters that the reader (LispReader.java) translates into (var x) when reading. (see http://clojure.org/special_forms#var)

Re: Why Isn't This Working

2009-02-01 Thread Onorio Catenacci
On Feb 1, 12:16 am, Meikel Brandmeyer wrote: > Hi, > > Am 01.02.2009 um 03:26 schrieb Onorio Catenacci: > > > (defn init-sheet > >    #^{:doc "Initialize a worksheet with a particular month"} > >    ([current-month] > >            (if debugging (println "In init-sheet")) > >    ) > > ) > > You do

Symbol to Namespace Qualified y

2009-02-01 Thread Craig McDaniel
git://github.com/kreg/traceme.git --~--~-~--~~~---~--~~ 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

Symbol to Namespace Qualified Symbol

2009-02-01 Thread Craig McDaniel
Anyone have a better method to go from a symbol to a namespace qualified symbol? I'm using this ugly kludge now: (symbol (.substring (.toString (resolve sym)) 2)) I'm keeping a map of currently traced functions and the key is the namespaced-qualified symbol of the function. See git://github.com

Re: Symbol to Namespace Qualified Symbol

2009-02-01 Thread Craig McDaniel
Make that http://github.com/kreg/traceme/tree/master to just view the project. --~--~-~--~~~---~--~~ 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 unsubscr

Re: what does -> mean?

2009-02-01 Thread kkw
Hi sun, I thought this question looked familiar. I found some answers here also: http://groups.google.com/group/clojure/browse_thread/thread/1f21663ea1ae9f58/ Kev On Feb 2, 2:29 am, Adrian Cuthbertson wrote: > Sorry! That should have read; > (-> m :one :b) > 2 > > > > On Sun, Feb 1, 2009

Re: Clojure Library Documentation

2009-02-01 Thread Mark Addleman
More as a note to future Clojure doc'ers than anything else: It seems that noobies (including myself) get bitten by the lazy versus immediate evaluation functions all the time (e.g. for versus doseq/ doall). If this problem isn't solved through naming conventions (probably way too tedious to be

Re: what does -> mean?

2009-02-01 Thread e
This may be obvious to others, but what's the motivation behind it? Is it that we are very concerned about combatting the criticism that lisp has too many parens? On Sun, Feb 1, 2009 at 3:09 PM, kkw wrote: > > Hi sun, > >I thought this question looked familiar. I found some answers here >

Re: Clojure Library Documentation

2009-02-01 Thread e
i was talking about something related in the chat group, but I'm not good enough yet to implement it. I want to rewrite the doc method slightly in a way that would go a LONG way for newbies. The current way actually looks like java . . . like the parens are around the input params. But that's ju

Re: Symbol to Namespace Qualified Symbol

2009-02-01 Thread Stephen C. Gilardi
On Feb 1, 2009, at 2:44 PM, Craig McDaniel wrote: Anyone have a better method to go from a symbol to a namespace qualified symbol? I'm using this ugly kludge now: (symbol (.substring (.toString (resolve sym)) 2)) I'm keeping a map of currently traced functions and the key is the namespaced-qu

Killing/interrupting agents?

2009-02-01 Thread Stuart Sierra
Hi Rich, hi all, A question: is it possible to kill or interrupt an agent during a long- running action, e.g., (def the-agent (agent nil)) (send-off the-agent really-long-action) ;; Oops, I changed my mind. (interrupt the-agent) ;; The thread running really-long-action stops,

Re: a question about binding

2009-02-01 Thread Eric
Thanks so much! --~--~-~--~~~---~--~~ 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...@googl

Re: what does -> mean?

2009-02-01 Thread Mike Benfield
On Feb 1, 3:35 pm, e wrote: > This may be obvious to others, but what's the motivation behind it?  Is it > that we are very concerned about combatting the criticism that lisp has too > many parens? > Applying functions in succession without giving a name to each intermediate value can be very

Re: Killing/interrupting agents?

2009-02-01 Thread Timothy Pratley
Hi Stuart, > One option would be to use a second agent as a flag.  My really-long- > action function could periodically check the value of that agent, and > terminate if it's been set to true.  But would it be possible to > provide a generic interrupt mechanism that doesn't require modifying > th

CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-01 Thread David Nolen
I've changed the name of my project since that was a joke anyway. http://github.com/swannodette/spinoza/tree/master Spinoza isn't just for people who want object oriented behaviors. It's also for anyone who plans on instantiating many structs. Spinoza's make-instance macro automatically orders y

Downloading the Java SE API documentation

2009-02-01 Thread Vincent Foley
Hello everyone, For the past few weeks, I've been having problems with my Internet connection, losing my signal for hours sometimes and during that time, I cannot program, because I don't have access to the Java API documentation. I looked on Sun's site, but I couldn't find a way to download it.

Re: Downloading the Java SE API documentation

2009-02-01 Thread Stephen C. Gilardi
On Feb 1, 2009, at 9:54 PM, Vincent Foley wrote: Does anyone know where I could get [downloadable Java API Documentation] in HTML format? On this page: http://java.sun.com/javase/downloads/index.jsp search for Java SE 6 Documentation The file "jdk-6u10-docs.zip" unzips t

removing duplicates from combinatorics/selections

2009-02-01 Thread kyle smith
The selections function in combinatorics returns more than what I need. (selections [ 1 2 3 4 5] 3) will return both (1 2 3) and (3 2 1), etc. However, I still need (1 1 1) (2 2 2), etc. I've tried several times to write a function to filter out the 'duplicates', but haven't quite got it. --~--

Re: removing duplicates from combinatorics/selections

2009-02-01 Thread Mark Engelberg
I'm not sure exactly what you want to remove, but it sounds like you might be looking for something like: (set (map sort (selections [1 2 3 4 5] 3))) or: (for [i (range 1 6) j (range i 6) k (range j 6)] [i j k]) On Sun, Feb 1, 2009 at 8:12 PM, kyle smith wrote: > > The selections function in

Re: removing duplicates from combinatorics/selections

2009-02-01 Thread Mark Engelberg
On Sun, Feb 1, 2009 at 8:25 PM, Mark Engelberg wrote: > (set (map sort (selections [1 2 3 4 5] 3))) or (distinct (map sort (selections [1 2 3 4 5] 3))) if you want to generate the values lazily rather than all at once. --~--~-~--~~~---~--~~ You received this mess

Re: Symbol to Namespace Qualified Symbol

2009-02-01 Thread Craig McDaniel
Thanks Steve. I'm going with your suggestion to use the var itself rather than the symbol as the key. It simplifies things. -Craig --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gro

Re: removing duplicates from combinatorics/selections

2009-02-01 Thread Mark Engelberg
I've written up a fast, iterative version of a "unique-selections" function, consistent with the approach taken in the other combinatorics functions. http://paste.lisp.org/display/74710 I haven't benchmarked it, but I would expect this version to be the fastest of the alternatives mentioned here

Re: Got a Clojure library?

2009-02-01 Thread Craig McDaniel
Name: clojure.contrib.server-socket.clj URL:http://code.google.com/p/clojure-contrib/ Author: Craig McDaniel Category: net License: ECL Description: An enhancement of Rich's original socket-server example that keeps track of client connections, closing them when the go away. It also includes a