Strange problem when adding type to a var defined by a macro.

2010-01-08 Thread Nicolas Buduroi
Hi, I'm using macros to define special vars (w/ a keyword as type) to retrieve them later with ns-utils/ns-vars and filter them. I don't know if this technique is recommended or if there's some better way to achieve this, but there's something weird happening when we try to evaluate the var defined

Re: reader and "s

2010-01-08 Thread Chouser
On Fri, Jan 8, 2010 at 7:34 PM, Raoul Duke wrote: > hi, > > i'm using (read) and it seems to get rid of double quotes e.g. This seems very unlikely to me, though it would be easier to tell for sure if you included the code that was failing. Perhaps the problem is when you print the form after it

reader and "s

2010-01-08 Thread Raoul Duke
hi, i'm using (read) and it seems to get rid of double quotes e.g. (println "foo") is read as (println foo) as far as i can tell so far. how do i get the quotes to come through? or don't i want to? thanks! -- You received this message because you are subscribed to the Google Groups "

reader heisenbug

2010-01-08 Thread Raoul Duke
sometimes (i can't repro it now that i restarted the repl?!) (let [stream (new java.io.PushbackReader (new java.io.FileReader "/tmp/foo.clj"))] (loop [s stream] (println "read" (read s nil nil)) (recur s))) in Clojure 1.1.0-new-SNAPSHOT repl to echo a file, i get java.lang.NullPointerException (N

Re: parallel vs serial iteration in a "for" loop

2010-01-08 Thread Conrad
Thanks again Sean/Chouser- Sounds like there isn't any easy way to do in-step iteration using the "for" construct, as I suspected- This is of course easily remedied for writing a convenience function for "(map vec ...)" (As I mentioned in the top post, I am aware the simple example I gave can be w

the Bay Area Clojure user group is 1 year old!

2010-01-08 Thread Amit Rathore
And now for something completely different... The baclojure meetup had our 13th meetup yesterday, and here are some pictures - http://baclojure.org/photos/798526/12537681/ This was our largest attendance so far (not counting the one Rich Hickey came to, that was > 80 people). We had about 35 peop

Re: C interop lib (JNA wrapper)

2010-01-08 Thread Chouser
On Fri, Jan 8, 2010 at 3:38 PM, mac wrote: > > But interface-wise on the clojure side I guess my lib and clojure-jna > are kind of similar so if clojure-jna good enough there is no reason > to switch to my lib. I was certainly inspired by clojure-jna since I > had used it before :) If clojure-jna

Re: C interop lib (JNA wrapper)

2010-01-08 Thread mac
On Jan 8, 8:53 pm, Rob Wolfe wrote: > mac writes: > > Hello all. > > I've started work on a clojure library for interoperating with C. It's > > always been a pain to do in Java but recently JNA (java native access) > > has taken away most of that pain. > > When using clojure however, it's nice

Re: C interop lib (JNA wrapper)

2010-01-08 Thread Rob Wolfe
mac writes: > Hello all. > I've started work on a clojure library for interoperating with C. It's > always been a pain to do in Java but recently JNA (java native access) > has taken away most of that pain. > When using clojure however, it's nice to be able to stay in clojure > and not drop to ja

Re: First meeting of the NYC Clojure Users Group is scheduled

2010-01-08 Thread Stuart Sierra
Also, everyone is welcome to join LispNYC on Tuesday, January 12 and celebrate release 1.1 of Clojure! -SS > Join us Tuesday, January 12th from 7:00 to 9:00 at P&G's for the first > social of the year! > > Directions: > > Near the 1 stop at 79th and B,C stop at 81st. Head to the northwest > corne

Re: multiple ns defprotocol/deftype?

2010-01-08 Thread Raoul Duke
ah hah. i think. (ns nst1) (deftype T1 [f1]) (println (ns-publics 'nst1)) (ns nst2) (defprotocol P2 (foo [this])) (deftype T2 [f2] :as this P2 (foo [] this)) (println (ns-publics 'nst2)) (ns nst3) (println "nst3 using nst2" (nst2/foo (nst2/T2 1))) (ns nst4) (deftype T4 [f4] :as this nst2/P2 (fo

Re: multiple ns defprotocol/deftype?

2010-01-08 Thread Konrad Hinsen
On 08.01.2010, at 20:21, Raoul Duke wrote: might anybody have examples of how one deftype can implement protocols from multiple other namespaces? i have not yet been able to suss out the correct syntax i guess. There's nothing special about protocols. defprotocol creates a protocol object an

multiple ns defprotocol/deftype?

2010-01-08 Thread Raoul Duke
hi, might anybody have examples of how one deftype can implement protocols from multiple other namespaces? i have not yet been able to suss out the correct syntax i guess. thank you! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gro

Re: parallel vs serial iteration in a "for" loop

2010-01-08 Thread Sean Devlin
Oh, right. I saw "paralell" and the brain hit autopilot. And I think you CAN improve on your fn a little bit. This should do the trick (map + (range 1 5) (range 11 15)) The mapping fn itself will be applied to as many arguments as you have collections. Since + is variadic, it will do the job

Re: Newbie question on XML processing

2010-01-08 Thread Tzach
Thanks Sean This is very helpful. Tzach On Jan 8, 5:44 am, Sean Devlin wrote: > Tzach, > I'd start will clojure.xml.  At a very high level, my program would > look like this > > 1.  Load the xml file with clojure.xml/parse > 2.  Apply your filtering code with something like map-if (see below) >

Re: [ANN] clj-peg v0.6 released

2010-01-08 Thread Michał Kwiatkowski
On Fri, Jan 8, 2010 at 4:38 PM, Richard Lyman wrote: > Currently I'm only providing the code in AOT form. If the JAR is on your > classpath everything in the manual works just fine. > > Did that answer your question? Yes, thank you! Cheers, mk -- You received this message because you are subscr

Re: clj-peg v0.6 released

2010-01-08 Thread Paul Mooser
At some point, hopefully someone will write an open-source parsing library with liberal licensing terms for clojure. -- 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

Re: parallel vs serial iteration in a "for" loop

2010-01-08 Thread Conrad
Thanks Sean... Sorry, I should have used a better word than "parallel"- The second code example shows what I mean... I'm not referring to multithreaded parallelism, but simply being able to iterate through two lists in step, as Chouser describes. (as you can do by passing two different seqs to "ma

Re: parallel vs serial iteration in a "for" loop

2010-01-08 Thread Chouser
On Fri, Jan 8, 2010 at 11:34 AM, Sean Devlin wrote: > Take a look at pmap I don't think that's the kind of "parallel" being asked about. > On Jan 8, 11:13 am, Conrad wrote: >> Looping variables in a clojure "for" loop are iterated in a serial, >> cartesian fashion: >> >> > (for [a (range 5) b (

Re: parallel vs serial iteration in a "for" loop

2010-01-08 Thread Sean Devlin
Take a look at pmap On Jan 8, 11:13 am, Conrad wrote: > Looping variables in a clojure "for" loop are iterated in a serial, > cartesian fashion: > > > (for [a (range 5) b (range 10 15)] > >        (+ a b)) > (10 11 12 13 14 11 12 13 14 15 12 13 14 15 16 13 14 15 16 17 14 15 16 > 17 18) > > I was

parallel vs serial iteration in a "for" loop

2010-01-08 Thread Conrad
Looping variables in a clojure "for" loop are iterated in a serial, cartesian fashion: > (for [a (range 5) b (range 10 15)] (+ a b)) (10 11 12 13 14 11 12 13 14 15 12 13 14 15 16 13 14 15 16 17 14 15 16 17 18) I was wondering if there's a standard idiom for looping in parallel fashion- Doe

C interop lib (JNA wrapper)

2010-01-08 Thread mac
Hello all. I've started work on a clojure library for interoperating with C. It's always been a pain to do in Java but recently JNA (java native access) has taken away most of that pain. When using clojure however, it's nice to be able to stay in clojure and not drop to java (or C *shudder*). It's

First meeting of the NYC Clojure Users Group is scheduled

2010-01-08 Thread Thorsen Eric
We'll be meeting on January 28th starting at 6:30pm at: NYC Seminar and Conference Center 71 West 23rd Street NY, NY 10010 1-866-807-1114 I'd like to invite people to do some lightening talks and/presentations about what they are doing with Clojure. Please contact me if you are interested in gi

Re: generating a fn with a body based on user inputs, possible?

2010-01-08 Thread tristan
Thanks Chouser! I had not thought of moving the (list 'fn ...etc) bit into the eval statement, it works perfectly! here is the final result! http://github.com/tristan/modelmaker/blob/d7dbdfa9b998cfc6b846ea5c235b4496ed8caa63/infix_parser.clj .Tristan On 8 Jan., 16:15, Chouser wrote: > On Fri, Jan

Re: [ANN] clj-peg v0.6 released

2010-01-08 Thread Richard Lyman
Currently I'm only providing the code in AOT form. If the JAR is on your classpath everything in the manual works just fine. Did that answer your question? -Rich 2010/1/7 Michał Kwiatkowski > On Mon, Jan 4, 2010 at 11:27 PM, Richard Lyman > wrote: > > This project adds support in Clojure for

Re: generating a fn with a body based on user inputs, possible?

2010-01-08 Thread Chouser
On Fri, Jan 8, 2010 at 9:10 AM, tristan wrote: > > At first I thought I had solved it, as calling (parse-infix "a*(b+c)") > returned the desired function that i could call. However as soon as i > attempted to use it in the form (parse-infix users-input) it falls > over with a "Don't know how to cr

Re: generating a fn with a body based on user inputs, possible?

2010-01-08 Thread Laurent PETIT
Hello, parse-infix, being a macro, works on the code-as-datastructure it has as arguments. So (parse-infix x) receives the symbol x , unevaluated, is in charge of returning a new datastructure (generally involving the symbol x). Only then, the compiler will evaluate the result of having called pa

Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean

2010-01-08 Thread Steven E. Harris
Phil Hagelberg writes: > If someone would volunteer to fix it, I'd be thrilled. Nobody who is > interested in using CL and Clojure at the same time has stepped > forward so far, which is why it's currently broken. Can you characterize what needs to be fixed? -- Steven E. Harris -- You receiv

Re: Having difficulties with compilation in slime, emacs and clojure-project

2010-01-08 Thread Zef Hemel
Thanks, indeed, swank-clojure was not on my classpath, I added it as a dependency to my project.clj and now it works fine. On Jan 8, 2:25 pm, Shawn Hoover wrote: > On Fri, Jan 8, 2010 at 4:39 AM, Zef Hemel wrote: > > After I do the swank clojure project command, enter the directory and > > press

generating a fn with a body based on user inputs, possible?

2010-01-08 Thread tristan
Hi guys, I've been working on a problem where I want the user to be able to input an equation in infix notation which includes variables and convert that to a clojure fn that my program can call later. i.e. the user inputs the string "a*(b+c)" and i generate the unnamed function (fn [a b c] (* a

Re: Having difficulties with compilation in slime, emacs and clojure-project

2010-01-08 Thread Shawn Hoover
On Fri, Jan 8, 2010 at 4:39 AM, Zef Hemel wrote: > After I do the swank clojure project command, enter the directory and > press return my Emacs gets stuck doing this: http://imgur.com/Ap8mo > When I just go to the Slime CLI that works fine. Any idea what could > be wrong there? > > Zef > Check

Re: Having difficulties with compilation in slime, emacs and clojure-project

2010-01-08 Thread Shawn Hoover
On Thu, Jan 7, 2010 at 11:37 PM, Joel wrote: > Hello, > I have an emacs setup on OSX using elpa with the latest clojure-mode, > swank-clojure, slime, slime-repl all from ELPA. When I upgraded to the > latest swank-clojure in ELPA (swank-clojure-1.1.0), I began to get > this error as well: > > > S

Re: Recommended JVM flags for Clojure

2010-01-08 Thread Gabi
Ok guys, After trying all your suggestions, here is the combination that worked best for me (in the order of their impact solving the problem): JVM_FLAGS="-server \ -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode \ -XX:+UseCompressedOops \ -XX:+DoEscapeAnalysis \ -XX:+UseBiasedLocking \ -XX:Perm

Re: Probability Monad

2010-01-08 Thread Konrad Hinsen
On 08.01.2010, at 06:21, joel r wrote: But right now I need some help. Either I'm using dist-m wrong, or it's a bug I've found. It's a bug. More specifically, a typo in a recent improvement. It is fixed now, so please try again with the current version - or in fact go back to an older vers

Re: Having difficulties with compilation in slime, emacs and clojure-project

2010-01-08 Thread Zef Hemel
After I do the swank clojure project command, enter the directory and press return my Emacs gets stuck doing this: http://imgur.com/Ap8mo When I just go to the Slime CLI that works fine. Any idea what could be wrong there? Zef -- You received this message because you are subscribed to the Google

Re: Understanding the continuation monad's bind operator

2010-01-08 Thread Konrad Hinsen
On 8 Jan 2010, at 02:43, Steven E. Harris wrote: Can you recommend a book that covers aspects of monads like these? I'd like to learn more about the abstract concepts than their implementation in a particular language. I don't know about any books. There's a lot of monad material on the W