Re: noob : congomongo to disk

2010-06-07 Thread Meikel Brandmeyer
Hi, On Jun 6, 11:15 pm, Brian Wolf brw...@gmail.com wrote: hmm.. not really 'printing', just trying to save what might be any binary data in a clojure map, as I would save say, want to save gif images  in a java or C array. at least that's the analogy I am comparing this case to. This is

Re: noob : congomongo to disk

2010-06-07 Thread Meikel Brandmeyer
Hi, On Jun 6, 11:26 pm, Brian Wolf brw...@gmail.com wrote: I'm not sure why it does this anyways, according to congomongo documentation, 'fetch' is supoosed be returning in clojure format, not mongo. The documentation means that you don't JSON back, but some clojure data structure. It

Re: numerator fn

2010-06-07 Thread Steve Purcell
On 7 Jun 2010, at 04:28, Dave Pawson wrote: On 6 June 2010 13:35, Moritz Ulrich ulrich.mor...@googlemail.com wrote: Note the Added in Clojure version 1.2 in the documentation of numerator ;-) Not until I'd blown up the text. Don't expect text that size to be read by everyone? If the

Re: Complex type in clojure

2010-06-07 Thread Steven Devijver
For what it's worth, I found that working with complex numbers in clojure doesn't require specialist types or notation at all: (defn complex-times [[a_re a_im] [b_re b_im]] [(- (* a_re b_re) (* a_im b_im)) (+ (* a_re b_im) (* a_im b_re))]) (defn complex-plus [[a_re a_im] [b_re b_im]] [(+ a_re

Re: numerator fn

2010-06-07 Thread Dave Pawson
On 7 June 2010 07:58, Steve Purcell st...@sanityinc.com wrote: On 7 Jun 2010, at 04:28, Dave Pawson wrote: On 6 June 2010 13:35, Moritz Ulrich ulrich.mor...@googlemail.com wrote: Note the Added in Clojure version 1.2 in the documentation of numerator ;-) Not until I'd blown up the text.

A simple distribution service

2010-06-07 Thread schani
Hi everybody, I've implemented a very simple job distribution service: http://github.com/schani/clj-simple-dist It's based on RMI, so it requires Clojure 1.2 to serialize Clojure data. It's (supposed to be) fault-tolerant, very simple to set up and even has a little web interface that

Loop and Recur

2010-06-07 Thread Jon Seltzer
I'm still learning Clojure and doing so by reading everything on clojure.org. I ran across this example in the Functional Programming section: (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)] (if (and my-keys my-vals) (recur (assoc

problem with Character/isLetter

2010-06-07 Thread AJ Sterman
(Character/isLetter x) #CompilerException java.lang.IllegalArgumentException: No matching method found: isLetter (NO_SOURCE_FILE:79) i tried a few use ' and there was no avail Thank you for trying to help -- You received this message because you are subscribed to the Google Groups Clojure

studying core.clj, questions on read-lines, lazy-seq, and if-let

2010-06-07 Thread toddg
I'm attempting to read and understand core.clj, and I'm walking through methods as I run into them, trying to understand them, line by line. I' mostly understand read-lines (w/ the exception of the last line), but I do not follow lazy-seq or if-let. Could someone check my deconstruction of

Re: problem with Character/isLetter

2010-06-07 Thread Moritz Ulrich
isLetter accepts single characters, you gave it a string with a length of one. The error is caused by reflection when clojure searches for a function with the signature isLetter(String) On Monday, June 7, 2010, AJ Sterman idonthav...@gmail.com wrote:  (Character/isLetter x) #CompilerException

Re: Loop and Recur

2010-06-07 Thread Steve Purcell
On 6 Jun 2010, at 15:30, Jon Seltzer wrote: I'm still learning Clojure and doing so by reading everything on clojure.org. I ran across this example in the Functional Programming section: (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)]

Re: Loop and Recur

2010-06-07 Thread Steve Purcell
On 7 Jun 2010, at 12:43, Steve Purcell wrote: Empty seqs are logically true, so your if condition is always true. Apologies; I'm talking rubbish: user= (if '() (println truthy)) truthy nil user= (if (seq '()) (println truthy)) nil -- You received this message because you are subscribed to

Re: Loop and Recur

2010-06-07 Thread Bruce Durling
Steve and Jon, On Mon, Jun 7, 2010 at 12:43, Steve Purcell st...@sanityinc.com wrote: Empty seqs are logically true, so your if condition is always true. I was looking at that today too. I did ( 0 (count my-list)) in my if statement to fix it. Is the Recursive Looping example on

Re: Loop and Recur

2010-06-07 Thread Bruce Durling
Steve, On Mon, Jun 7, 2010 at 12:48, Steve Purcell st...@sanityinc.com wrote: On 7 Jun 2010, at 12:43, Steve Purcell wrote: Empty seqs are logically true, so your if condition is always true. Apologies; I'm talking rubbish: user= (if '() (println truthy)) truthy nil user= (if (seq '())

Re: Loop and Recur

2010-06-07 Thread patrik karlin
calling rest dosent give you nil it gives you an empty seq so the if statment never fails try (defn my-zipmap [keys vals] (loop [my-map {} [kf kr] (seq keys) [vf vr] (seq vals)] (if (and kf vf) (recur (assoc my-map kf vf) kr vr) my-map))) 2010/6/6 Jon Seltzer

Re: Loop and Recur

2010-06-07 Thread patrik karlin
So its the calling of first that gives you nil here is some example code user= (rest '(2)) () user= (rest '()) () user= (first '()) nil 2010/6/7 patrik karlin patrik.kar...@gmail.com: calling rest dosent give you nil it gives you an empty seq so the if statment never fails try (defn

Re: Loop and Recur

2010-06-07 Thread Stuart Halloway
Hi Bruce, That doc page used pre-1.0 Clojure code, which, as you saw, doesn't work. Thanks for the catch, I have fixed the docs on the site. Stu Steve and Jon, On Mon, Jun 7, 2010 at 12:43, Steve Purcell st...@sanityinc.com wrote: Empty seqs are logically true, so your if condition is

Re: Loop and Recur

2010-06-07 Thread Bruce Durling
Stu, On Mon, Jun 7, 2010 at 13:08, Stuart Halloway stuart.hallo...@gmail.com wrote: That doc page used pre-1.0 Clojure code, which, as you saw, doesn't work. Thanks for the catch, I have fixed the docs on the site. Thanks. I think my mistake was mixing up rest (which always returns a sequence

SLIME REPL clojure completion

2010-06-07 Thread Rick Moynihan
I've just updated slime to 20100404 in ELPA, and I've noticed that tab completion in the REPL buffer has stopped working. Pressing TAB to complete a symbol prints No dynamic expansion for `user foo' found. Any ideas how to get this working again? R. -- You received this message because you

ILC 2010

2010-06-07 Thread aml
With the usual apologies to those who receive multiple copies of this... ~~~ International Lisp Conference 2010 October 19-21, 2010 John Ascuaga's Nugget (Casino)

Re: problem with Character/isLetter

2010-06-07 Thread .Bill Smith
To complete the thought, user= (Character/isLetter \x) true user= (Character/isLetter (.charAt x 0)) true On Jun 7, 6:17 am, Moritz Ulrich ulrich.mor...@googlemail.com wrote: isLetter accepts single characters, you gave it a string with a length of one. The error is caused by reflection when

Re: Loop and Recur

2010-06-07 Thread Joost
On Jun 7, 1:49 pm, Bruce Durling b...@otfrom.com wrote: Steve and Jon, On Mon, Jun 7, 2010 at 12:43, Steve Purcell st...@sanityinc.com wrote: Empty seqs are logically true, so your if condition is always true. I was looking at that today too. I did ( 0 (count my-list)) in my if statement

Re: Loop and Recur

2010-06-07 Thread Bruce Durling
Melkel, On Mon, Jun 7, 2010 at 15:55, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Jun 7, 4:25 pm, Bruce Durling b...@otfrom.com wrote: I have no problem with calling seq, I just don't understand why I need to. Because the initial collections might be empty. (my-zipmap [] []) = {} I

Re: SLIME REPL clojure completion

2010-06-07 Thread Phil Hagelberg
On Mon, Jun 7, 2010 at 5:41 AM, Rick Moynihan rick.moyni...@gmail.com wrote: I've just updated slime to 20100404 in ELPA, and I've noticed that tab completion in the REPL buffer has stopped working. Pressing TAB to complete a symbol prints No dynamic expansion for `user foo' found.  Any ideas

Re: SLIME REPL clojure completion

2010-06-07 Thread Rick Moynihan
On 7 June 2010 16:35, Phil Hagelberg p...@hagelb.org wrote: On Mon, Jun 7, 2010 at 5:41 AM, Rick Moynihan rick.moyni...@gmail.com wrote: I've just updated slime to 20100404 in ELPA, and I've noticed that tab completion in the REPL buffer has stopped working. Pressing TAB to complete a symbol

Re: studying core.clj, questions on read-lines, lazy-seq, and if-let

2010-06-07 Thread Joost
On Jun 7, 6:37 am, toddg t.greenwoodg...@gmail.com wrote: I'm attempting to read and understand core.clj, and I'm walking through methods as I run into them, trying to understand them, line by line. I' mostly understand read-lines (w/ the exception of the last line), but I do not follow

Re: API in Clojure for Java folklore

2010-06-07 Thread Jason Smith
I think the right place for this is Maven, Ant, Leiningen, and command line. It's a generic thing for any build system. :-) Generating correct stubs is the common part, and then there is an integration into each system. I'm most interested in having this for Maven, but there's really not much

Re: Complex type in clojure

2010-06-07 Thread Mark Engelberg
Yes, but in (some versions of) Scheme, (sqrt -1) yields i. Representing complex numbers and just doing math between two complex numbers is not the problem. Retrofitting Clojure math so that all operations work on the entire numeric tower, allowing you to seamlessly manipulate complex and

Re: problem with Character/isLetter

2010-06-07 Thread Michael Wood
On 7 June 2010 16:50, .Bill Smith william.m.sm...@gmail.com wrote: To complete the thought, user= (Character/isLetter \x) true user= (Character/isLetter (.charAt x 0)) true or: user= (first x) \x user= (Character/isLetter (first x)) true On Jun 7, 6:17 am, Moritz Ulrich

Re: Lein deps failure

2010-06-07 Thread patrik karlin
Hey Brian change [org.clojure/swank-clojure 1.2.1] = [swank-clojure 1.2.1] 2010/6/7 Brian Troutwine br...@troutwine.us: Hello all, I have the following in project.clj in my newly lein generated project: (defproject void 1.0.0  :description A toy.  :dependencies [[org.clojure/clojure

Re: Lein deps failure

2010-06-07 Thread Brian Troutwine
Interesting, that works perfectly. Thanks! Why does this work? On Mon, Jun 7, 2010 at 12:16 PM, patrik karlin patrik.kar...@gmail.com wrote: Hey Brian change [org.clojure/swank-clojure 1.2.1] = [swank-clojure 1.2.1] 2010/6/7 Brian Troutwine br...@troutwine.us: Hello all, I have the

Re: Complex type in clojure

2010-06-07 Thread Travis Hoffman
Personally, I thinks it would be much more elegant to have a direct notation. It could be argued that the Ratio type could also be implemented without a special Ratio type, but where's the fun in that? Consider: (* 3.4+7i 15i) vs (complex-multiply (construct-complex 3.4 7) (construct-complex 0

Re: Lein deps failure

2010-06-07 Thread Meikel Brandmeyer
Hi, Am 07.06.2010 um 21:20 schrieb Brian Troutwine: Why does this work? change [org.clojure/swank-clojure 1.2.1] = [swank-clojure 1.2.1] Each dependency has a group and an artifact name. org.clojure/swank-clojure means group org.clojure and artifact swank-clojure. swank-clojure is a short

introspecting types and records

2010-06-07 Thread Chris Kent
Hi Is there a way to introspect types defined with deftype and defrecord? I'd just like to know the field names and their order in the constructor. Java reflection works fine but requires some fiddling around to filter the static fields and __meta and __extmap. It feels like something that

Using Apache Camel with Clojure

2010-06-07 Thread jwhitlark
I wrote up a quick post on my experience with using Apache Camel from Clojure. For anyone who's interested, you can find it at http://codeabout.blogspot.com/2010/06/using-apache-camel-from-clojure.html Thanks, ~J -- You received this message because you are subscribed to the Google Groups