Re: 1.2 contrib shuffles

2010-08-28 Thread B Smith-Mannschott
On Sat, Aug 28, 2010 at 07:00, Stuart Sierra the.stuart.sie...@gmail.comwrote: On Aug 27, 3:42 pm, B Smith-Mannschott bsmith.o...@gmail.com wrote: This thread got me thinking that when a namespace is partially promoted to Clojure proper, it might be good to provide a reduced version of the

Re: creating map throws ArrayIndexOutOfBounds (inconsistently)

2010-08-28 Thread santervo
It happens like this: In my keyboard, I get } with AltGr-0 Now, if I type { :a { :b C } }, and hold space down while typing AltGr-0, I get ArrayIndexOutOfBounds. In the screen there is no difference when holding the space down. Also, if i hold AltGr down after typing { (AltGr-7) when pressing

loop/recur stack overflow

2010-08-28 Thread neveu
I implemented the Flavius Josephus algorithm from Programming Praxis in Clojure using loop/recur. My first version looked like this: (defn rotate-left ([ln n m] (take n (drop (dec m) (cycle ln ([ln m] (rotate-left ln (count ln) m))) (defn josephus3 [N M] ;; execute every mth soldier

newbie question: where are my log messages going to?

2010-08-28 Thread Wei Hsu
Hello, I'm using the clojure.contrib.logging library (logging/spy seems very useful!) but I don't know which file it's writing to. Can you please advise? Thanks, Wei -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: where did I read that?

2010-08-28 Thread Robert McIntyre
I took a stab at it and came up with this: (defn make-reader [s] (java.io.PushbackReader. (java.io.CharArrayReader. (into-array Character/TYPE (seq s) (defn read-with-number like read but takes in a string and returns a function of no arguments which will

Re: Docstrings in Clojure?

2010-08-28 Thread Paddy3118
Thanks guys. I have mentioned Clojure in the Wikipedia entry for Docstrings at: http://en.wikipedia.org/wiki/Docstring On 19 Aug, 21:22, Paddy3118 paddy3...@googlemail.com wrote: Hi, Does clojure have docstrings:http://en.wikipedia.org/wiki/Docstring and, if so, do you have a link to the

Type hints in protocols and records

2010-08-28 Thread Francesco Bellomi
Hello, I'm trying to use type hints in protocols and records, but I found some strange behavior. As an example, if I use: (defprotocol test (test-fn [a ^String b])) the type hint in test-fn is parsed correctly (or at least without raising an error), but then... (defrecord test-record [x y

Re: Some clarifications about let form

2010-08-28 Thread HB
So, any time I want to declare a local variable (inside a function for example), I use let form. On Aug 26, 8:26 pm, nickikt nick...@gmail.com wrote: Its for defining look variables (constants) that you use more then once in your form and not have to write it more then once (or calculated it

Re: Leiningen 1.3.0 - compile task problem

2010-08-28 Thread lprefontaine
Fine, I'll post entire project in a tar file this week end and will come back with the URL before Sunday night. Need to complete urgent work in the garden today :) Luc P. Phil Hagelberg p...@hagelb.org wrote .. On Fri, Aug 27, 2010 at 8:06 PM, lprefonta...@softaddicts.ca wrote: I got it

I don't understand this method

2010-08-28 Thread HB
Hey, I came across this method: (use '[clojure.contrib.lazy-seqs :only (primes)]) (def ordinals-and-primes (map vector (iterate inc 1) primes)) map macro has this format: (map function collection) primes is the collection and (iterate inc 1) is the function to apply on each element of the

Re: creating map throws ArrayIndexOutOfBounds (inconsistently)

2010-08-28 Thread Steve Purcell
On 27 Aug 2010, at 19:40, santervo wrote: Also, if i hold AltGr down after typing { (AltGr-7) when pressing space button, i get this: user= { :a b } java.lang.Exception: Unable to resolve symbol: :a in this context (NO_SOURCE_FILE:0) Note from the spaces in the error message that

Re: I don't understand this method

2010-08-28 Thread Stephen C. Gilardi
(use '[clojure.contrib.lazy-seqs :only (primes)]) (def ordinals-and-primes (map vector (iterate inc 1) primes)) map macro has this format: (map function collection) The map function takes a function and any number of collections:

Re: I don't understand this method

2010-08-28 Thread nickikt
P.S. something I should of have said: map can take 1 function and more then one collection. Calling the function with the number of arguments of collections provided -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Some clarifications about let form

2010-08-28 Thread nickikt
yes, but you can not change it if you start a new (let ...). On 28 Aug., 16:22, HB hubaghd...@gmail.com wrote: So, any time I want to declare a local variable (inside a function for example), I use let form. On Aug 26, 8:26 pm, nickikt nick...@gmail.com wrote: Its for defining look

Re: I don't understand this method

2010-08-28 Thread HB
Ok, I understand what it does but I don't understand -yet- how it is works. Why vector and its parameters aren't in ( ) ? What are the parameters to the vector and what are the parameters to the map in the example? On Aug 28, 6:12 pm, nickikt nick...@gmail.com wrote: (iterate inc 1) is not the

Re: Type hints in protocols and records

2010-08-28 Thread Francesco Bellomi
thanks David, Is the support for type hints in protocols planned for future releases? Francesco On Aug 28, 5:10 pm, David Nolen dnolen.li...@gmail.com wrote: On Sat, Aug 28, 2010 at 9:46 AM, Francesco Bellomi francesco.bell...@gmail.com wrote: It is not clear to me if type hints are

Re: misunderstanding collection

2010-08-28 Thread John Newman
Don't forget destructuring: (for [[a b c] signal] (map (partial reduce +) [a b c])) and, ((fn [[[a b c][d e f]]] (map (partial reduce +) [a b c d e f])) signal) While messing around with that, I was wondering if there were some function that allowed you to destructure on-demand. Like, =

Re: I don't understand this method

2010-08-28 Thread gary ng
On Sat, Aug 28, 2010 at 8:37 AM, HB hubaghd...@gmail.com wrote: Ok, I understand what it does but I don't understand -yet- how it is works. Why vector and its parameters aren't in ( ) ? What are the parameters to the vector and what are the parameters to the map in the example? vector is

Re: misunderstanding collection

2010-08-28 Thread John Newman
A reader macro for destructuring might be nifty, like #[...]. So you could do things like: (#(map (partial reduce +) #a b c][d e f]]] %]) signal) Not sure if that'd be the right syntax, but you get the point. On Sat, Aug 28, 2010 at 12:08 PM, John Newman john...@gmail.com wrote: Don't

Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Luke VanderHart
For the past week or two, I've been investigating what it would take to write something that would allow *.clj and *.java files to seamlessly compile together, such that they could be freely intermixed in a project. I knew it was a difficult problem, but I think the adoption benefits would be

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Luke VanderHart
My apologies, the title got cut off. It should be: Is it possible in theory to write/modify a Clojure compiler that doesn't resolve Java references? On Aug 28, 12:50 pm, Luke VanderHart luke.vanderh...@gmail.com wrote: For the past week or two, I've been investigating what it would take to

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Michał Marczyk
Providing we're happy with disallowing circular dependencies (which is what javac and clojure.lang.Compiler do anyway), I wonder if it might be possible to have a build tool invoke the appropriate compilers on a file-by-file basis, so that if foo.java depends on a class generated by bar.clj, which

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Luke VanderHart
I'm not just talking about class hierarchy dependencies, but also reference dependencies. For example: Foo.java class Foo { public Bar getBar() {...} } Bar.java class Bar{ public Foo getFoo() {...} } This is pretty common in the Java world. What I'd like to do is have Foo be written in

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Michał Marczyk
Oh, I also think that mixing and matching Clojure Java modules -- groups of namespaces / classes which would be share a single build artifact -- is already fairly simple, whereas I'm not sure if mixing and matching at the level of individual source files -- with dependency chains like foo.java -

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Michał Marczyk
On 28 August 2010 19:19, Luke VanderHart luke.vanderh...@gmail.com wrote: I'm not just talking about class hierarchy dependencies, but also reference dependencies. Ah, I see. In that case, maybe generate placeholders for all the classes to be implemented in Clojure (with all methods doing

Re: misunderstanding collection

2010-08-28 Thread Mike Meyer
On Sat, 28 Aug 2010 12:23:04 -0400 John Newman john...@gmail.com wrote: A reader macro for destructuring might be nifty, like #[...]. I don't think so. But first, we already have an on-demand destructuring facility: let. So you could do things like: (#(map (partial reduce +) #a b c][d

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Michael Wood
On 28 August 2010 19:27, Michał Marczyk michal.marc...@gmail.com wrote: On 28 August 2010 19:19, Luke VanderHart luke.vanderh...@gmail.com wrote: I'm not just talking about class hierarchy dependencies, but also reference dependencies. Ah, I see. In that case, maybe generate placeholders for

Re: newbie question: where are my log messages going to?

2010-08-28 Thread ataggart
c.c.logging just delegates to the underlying logging implementation. If you haven't included a separate logging library on your classpath (e.g., log4j) then it will default to using java.util.logging. Note that by default the j.u.logging will output to stdout, and has a default threshold of INFO.

Re: JavaFX and Clojure

2010-08-28 Thread Mark Engelberg
On Fri, Aug 27, 2010 at 11:00 AM, Emeka emekami...@gmail.com wrote: Mark, Can JavaFX do that? Regards, Emeka I don't know that much about JavaFX, but my understanding is that it was born out of Sun's desire to compete with Adobe's Flash/Flex/AIR. Similarly, Silverlight is Microsoft's effort

Re: What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-28 Thread Laurent PETIT
Hi, 2010/8/18 Sean Corfield seancorfi...@gmail.com On Wed, Aug 18, 2010 at 1:36 PM, Greg g...@kinostudios.com wrote: Attached is a screenshot of some code from the wonderful Incanter library. I think it's a great illustration of how confusing stacking parenthesis can be (there are many

Re: where did I read that?

2010-08-28 Thread evins.mi...@gmail.com
On Aug 28, 1:41 am, Robert McIntyre r...@mit.edu wrote: I took a stab at it and came up with this: is that what you're going for? I was actually asking how to avoid doing what you did :-). If it's necessary to do it, that's fine, but I thought I'd ask first, in case there was a way around it

Re: misunderstanding collection

2010-08-28 Thread John Newman
#%3 %2 %1][%4 %5 %6]]] signal] - [c b a d e f] Right, the names are superfluous. So are the extra set of brackets I guess. Perhaps even better would be: (#[[_ _ _][_ _ _]] signal) Or if you wanted just the third item of the second collection: (#[[][2]] signal) Also, I took the signal

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Seth
This sounds very similar to groovyc: http://groovyland.wordpress.com/2009/03/03/groovyscalajava/ On Aug 28, 12:50 pm, Luke VanderHart luke.vanderh...@gmail.com wrote: For the past week or two, I've been investigating what it would take to write something that would allow *.clj  and *.java

Re: misunderstanding collection

2010-08-28 Thread Mike Meyer
On Sat, 28 Aug 2010 18:11:41 -0400 John Newman john...@gmail.com wrote: #%3 %2 %1][%4 %5 %6]]] signal] - [c b a d e f] Right, the names are superfluous. So are the extra set of brackets I guess. Perhaps even better would be: (#[[_ _ _][_ _ _]] signal) Or if you wanted just the

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Luke VanderHart
Hm, thanks for the reference to that groovy thread... an interesting read. I might take a stab at writing a *generate-stubs* patch to Clojure's compiler, just to see how hard it would be to do. Out of curiosity, if Rich or anyone on the dev team reads this, is this the sort of thing that might

Re: What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-28 Thread Sean Corfield
On Sat, Aug 28, 2010 at 1:10 PM, Laurent PETIT laurent.pe...@gmail.com wrote: I did find the 4 char indents easier to read than the 2 char indents. I wish CCW respected the displayed tab width setting as its indentation in strict structural mode as I'd rather have 4 spaces than 2 but it seems

Re: misunderstanding collection

2010-08-28 Thread Michał Marczyk
On 29 August 2010 00:11, John Newman john...@gmail.com wrote: I am going to see if I can write a function that does: = (destructure [[][2]] signal) (5 6 7 8) Note that the name is already taken by clojure.core/destructure, which is the engine behind all destructuring done by Clojure macros:

Re: Leiningen 1.3.0 - compile task problem

2010-08-28 Thread lprefontaine
Hi Phil, there's a tar file at this url with the entire project skeleton: http://cid-0bd9c1ec7356c53b.office.live.com/browse.aspx/lein-our-classes-only-0.0.1-SNAPSHOT?Bsrc=GetSharingLinkBpub=SDX.Docs I added a README file. There is a small twist when building the target. For those having the

Re: What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-28 Thread kyle smith
On Aug 19, 12:08 pm, Brian Goslinga quickbasicg...@gmail.com wrote: Here is another trick that works for me in Emacs:  delete most of the stack of closing parens, and then spam the ) key until the Emacs matches it to the desired opening paren. this. -- You received this message because you