Re: Native Clojure

2010-12-21 Thread nicolas.o...@gmail.com
If you want native with enough reflection to compile clojure, Objective-C might be a better choice than C++. -- 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 members

Re: Native Clojure

2010-12-21 Thread Alessio Stalla
On Monday, December 20, 2010 8:54:14 PM UTC+1, kaveh_shahbazian wrote: I understand hosting on a VM has it's own (huge) advantages: GC, libraries, proved practices and vast amount of research and community effort already available; no doubt on that part. It is just having a mature and

Re: Ah-hah! Clojure is a Lisp

2010-12-21 Thread Marko Koci?
You can use http://docs.google.com/viewer?url=http://url_to_pdf_or_doc_or_xls_or_something to see those documents converted to html. Works ok in most of the cases, even on my phone. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Ah-hah! Clojure is a Lisp

2010-12-21 Thread Sandeep
On Dec 20, 7:09 am, Tim Daly d...@axiom-developer.org wrote: It is the algebra language in the Axiom project called Spad.http://axiom-developer.org It is open source There is also Qi (http://www.lambdassociates.org/qilisp.htm). It is now morphing into Shen

Re: clojure - javascript

2010-12-21 Thread Shane Daniel
Hi everybody, Just for kicks I took Chouser's good start on the PersistentVector port and threw it in a Github gist, and demonstrated using it in jsFiddle. I love the cloud these days ;) Anyway, I hope you don't mind Chouser. I plan to refactor your code to use Javascript's prototype system,

Re: clojure - javascript

2010-12-21 Thread Shane Daniel
Hello there again. After reading my above post you were probably frustrated, as was I when I realized I had completely forgotten to include links to actual resources. D'oh. The gist is here: https://gist.github.com/749750 The jsFiddle demonstration (outputs to console) is here:

Re: clojure - javascript

2010-12-21 Thread Chouser
On Tue, Dec 21, 2010 at 6:51 AM, Shane Daniel simrpg...@gmail.com wrote: Hi everybody, Just for kicks I took Chouser's good start on the PersistentVector port and threw it in a Github gist, and demonstrated using it in jsFiddle. I love the cloud these days ;) Anyway, I hope you don't mind

Community attitude

2010-12-21 Thread Jay Fields
I was involved with Ruby and Rails in the early days. The Ruby mailing lists / conferences were always kind / helpful and the Rails lists / confs were always hit and miss. There were plenty of great Rails people, and enough jerks to upset anyone. I read this (Clojure) google group pretty

Re: Native Clojure

2010-12-21 Thread Santosh Rajan
On Tue, Dec 21, 2010 at 3:26 PM, Alessio Stalla alessiosta...@gmail.com wrote: It could be written on top of Common Lisp. There are natively compiled, multithreaded, cross-platform implementations of it, and building on another Lisp should be much easier than on C/C++. Of course, since

Re: Community attitude

2010-12-21 Thread .Bill Smith
I think those are fine points. And to reciprocate, I think it's important when you read someone's comments to give the writer the benefit of a doubt. Sometimes it helps to read between the lines. If you can tone down your emotional reaction to a comment that feels unpleasant, you may find

Re: Native Clojure

2010-12-21 Thread nicolas.o...@gmail.com
I am not a Clojure expert. But if I understood Clojure correctly, Clojure would not be Clojure if it where natively compiled. Eg. The whole lazy seq's are required because of lack of tail call optimization in the JVM. Or am I wrong? I don't think the lazy seq are necessary because of TCO.

Re: Community attitude

2010-12-21 Thread Baishampayan Ghose
Jay, [snip] I agree with your observations. The last few days have indeed been kind of upsetting. I hope everyone follows your suggestions. Also, what happened to Rich? It seems like many wasteful discussions could be more easily put to bed by his response instead of the current here's a

Out of memory

2010-12-21 Thread Miles Trebilco
Why does this cause an out of memory error: (def out_of_mem (reduce + 0 (range 5000))) while this does not: (def not_out_of_mem (let [result 0] (reduce + result (range 5000 and neither does this in the REPL: (reduce + 0 (range 5000))) - Miles -- You received this

Calling methods with a dollar sign in them

2010-12-21 Thread Seth
I am attempting to interop with scala. In scala, if you have a class which is a var, a method is defined in the .class file called varname_ $eq which will set the var. Problem is, clojure apprent converts dollar signs to the text _DOLLARSIGN_. Is there any way to prevent this? -- You received

Re: Calling methods with a dollar sign in them

2010-12-21 Thread Seth
oh, and the public var is defined as private in the .class file, so i can't use set! -- 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 members are moderated - please

Re: Native Clojure

2010-12-21 Thread Alessio Stalla
On Tuesday, December 21, 2010 2:55:58 PM UTC+1, Santosh Rajan wrote: On Tue, Dec 21, 2010 at 3:26 PM, Alessio Stalla alessi...@gmail.com wrote: It could be written on top of Common Lisp. There are natively compiled, multithreaded, cross-platform implementations of it, and building on

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 9:12 AM, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: (defn my-map [f l] (when l (cons (f (first l)) (my-map f (next l))) You can write a tail recursive version, but it would be equivalent to accumulating with a loop and reversing the result. Which you

Re: Community attitude

2010-12-21 Thread atreyu
I would like to think is a symptom of the growth of Clojure. More Clojure users from different perspectives and attitudes means more potential for conflict. But some attitudes only causes noise: in particular people who requires without counterpart and think Clojure is like Visual Basic and this

Re: clojure - javascript

2010-12-21 Thread nickik
The dream would be to have: - Everything for clojure in clojure - A nice compiler in clojure - java speed clojure - Collections and multimethodes in clojure - A js generating backend for the compiler that works with GWT for the required java stuff Unfortunately I do not (jet) have the skill to

Re: Native Clojure

2010-12-21 Thread nicolas.o...@gmail.com
In my experience lazy-seqs are a reasonable replacement for the lack of TCO, and from what I've heard that is one of the reasons they exist. (defn a [x]    (lazy-seq      (cons x (b (inc x) (defn b [x]    (lazy-seq      (cons x (a (inc x) David I am not sure I get you. COuld you

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 11:28 AM, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: I am not sure I get you. COuld you elaborate a bit more this example, please? Which tail-call functions are you trying to replace by a and b? Nicolas. Those are mutual recursive functions. Trying to

Re: Native Clojure

2010-12-21 Thread nicolas.o...@gmail.com
Those are mutual recursive functions. Trying to define them as regular functions will quickly result in a stack overflow. You could use trampoline but in my experience you will take a significant performance hit. Lazy sequences are a way to efficiently represent mutually recursive

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 11:41 AM, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: Those are mutual recursive functions. Trying to define them as regular functions will quickly result in a stack overflow. You could use trampoline but in my experience you will take a significant

Re: Native Clojure

2010-12-21 Thread nicolas.o...@gmail.com
With TCO mutually recursive functions do not consume the stack. The same is true for well constructed lazy sequences. David With TCO, mutually *tail* recursive functions do not consume the stack. non-tail call always consume the stack in non CPS compiled languages. (In which, it consumes the

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 11:54 AM, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: With TCO mutually recursive functions do not consume the stack. The same is true for well constructed lazy sequences. David With TCO, mutually *tail* recursive functions do not consume the stack.

Re: Native Clojure

2010-12-21 Thread Andrew Boekhoff
With TCO mutually recursive functions do not consume the stack. The same is true for well constructed lazy sequences. If the functions were: (defn f [x] (g x)) (defn g [x] (f x)) They would operate in constant space with tail-call optimization. (defn f [x] (cons x (g x))) (defn g [x] (cons x

Re: Native Clojure

2010-12-21 Thread nicolas.o...@gmail.com
Yes I know, I thought the way I wrote the code was clear about that :) I am sorry, I did not understand. So let me try to explicit your transformation (please correct me if I am wrong): - start with some mutually recursive functions: a and b, for example - create a lazy stack for the recursive

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 12:09 PM, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: Yes I know, I thought the way I wrote the code was clear about that :) I am sorry, I did not understand. So let me try to explicit your transformation (please correct me if I am wrong): - start with

Re: Native Clojure

2010-12-21 Thread nicolas.o...@gmail.com
I have an example to clarify what I understood of your idea: (declare odd) (defn even [x] (if (zero? x) [true] (lazy-seq nil (odd (dec x) (defn odd [ x] (if (zero? x) [false] (lazy-seq nil (even (dec x) (defn get-value [l]

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 12:20 PM, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: I have an example to clarify what I understood of your idea: (declare odd) (defn even [x] (if (zero? x) [true] (lazy-seq nil (odd (dec x) (defn odd [ x] (if

Re: Native Clojure

2010-12-21 Thread nicolas.o...@gmail.com
It's a funy and original trick but on this example at least, it seems slower (and it can use a lot of memory, because it retains a stack in the heap) than trampoline: (time (get-value (even 1500))) Elapsed time: 1899.881769 msecs And a version with trampoline (defn odd [^long x] (if

Re: Community attitude

2010-12-21 Thread Kevin Downey
great, yet another email on the list so unrelated to clojure that not only does it contain no code, but no reference to code. if you need to whinge publicly please do it on your own blog. if you don't feel like the clojure community is giving you the love and support you need then I am sure rails

Re: Working with maps and vectors

2010-12-21 Thread Anclj
Hi again, I still don't know how to use the filter function. I have a map of provinces - seats like: (def provs {p1 5, p2 8, p3 13, p4 11}) And a sequence of province - party - votes like: (def votes [[A p1 32] [B p1 55] [A p2 77] [B p2 21]]) In order to get the lazy sequence for every

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 12:44 PM, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: It's a funy and original trick but on this example at least, it seems slower (and it can use a lot of memory, because it retains a stack in the heap) than trampoline: (time (get-value (even 1500)))

Re: Working with maps and vectors

2010-12-21 Thread Benny Tsai
'filter' is for getting a subset of the elements in a collection. For getting the names of the provinces, what you want is to get all the keys from your 'provs' map, which can be done via the 'keys' function. user= (keys provs) (p1 p2 p3 p4) Personally, I find ClojureDocs' Quick Reference

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 12:08 PM, Andrew Boekhoff boekho...@gmail.comwrote: With TCO mutually recursive functions do not consume the stack. The same is true for well constructed lazy sequences. If the functions were: (defn f [x] (g x)) (defn g [x] (f x)) They would operate in constant

Re: name protect anonymous macros ?

2010-12-21 Thread Nate Young
On 12/17/2010 09:54 AM, Trevor wrote: 2. Is there a form for anonymous macros? i.e. I know I can do : (fn[x](do x)), but can I not do: (macro[x](let [x# x] `(do x))) ? Thanks! A little tardy, but Konrad Hinsen has written a handful of CL-like functions for symbol macros and macrolet

Automatically unmapping unit tests from namespaces

2010-12-21 Thread Alyssa Kwan
Hi everyone, My typical development workflow is to use leiningen to create a project stub, modify project.clj to add swank-clojure as a dev- dependency, and run lein-swank and connect from Emacs slime. As I create and modify files in the test and src namespaces/directory structures, I use C-c

Re: Out of memory

2010-12-21 Thread Ken Wesson
On Tue, Dec 21, 2010 at 9:09 AM, Miles Trebilco miles.van...@gmail.com wrote: Why does this cause an out of memory error: (def out_of_mem  (reduce + 0 (range 5000))) while this does not: (def not_out_of_mem  (let [result 0]  (reduce + result (range 5000 and neither does

Re: Out of memory

2010-12-21 Thread Tim Robinson
You may want to consider the heap size you have allocated to java. I believe the default is 128. For example you can set this yourself: java -Xms256m -Xmx1024m This provides 256mb initial heap and permits heap to grow to 1024mb. I've been using Leiningen, so in my case I just changed the

Re: Working with maps and vectors

2010-12-21 Thread Stephen Pardue
user= (first (first provs)) p1 user= On Tue, Dec 21, 2010 at 1:18 PM, Benny Tsai benny.t...@gmail.com wrote: 'filter' is for getting a subset of the elements in a collection. For getting the names of the provinces, what you want is to get all the keys from your 'provs' map, which can be done

Re: Out of memory

2010-12-21 Thread Laurent PETIT
2010/12/21 Tim Robinson tim.blacks...@gmail.com You may want to consider the heap size you have allocated to java. I believe the default is 128. For example you can set this yourself: java -Xms256m -Xmx1024m Indeed, but in this example, there is a problem. As Ken said, it seems that the

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Stuart Sierra
You can delete the entire test namespace with `remove-ns` and then do `(require ... :reload)`. Or try Lazytest. :) -Stuart Sierra -- 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

Re: Community attitude

2010-12-21 Thread ninjudd
Well, I'm glad to have you in the Clojure community, Jay. I come from a Ruby background too, and I've enjoyed your blog over the years. Your interest in Clojure has helped me get other Rails developers at work excited about Clojure. On the topic of community attitude, I agree with you. There are

SCA FAQ link at clojure.org/contributing....

2010-12-21 Thread Mike Meyer
The link to the SCA FAQ on the page at clojure.org/contributing now returns a document not found page. Given that the Clojure CA is based on the Sun Contributor Agreement and what Oracle has since done with NotQuiteSoOpenSolaris, this would seem to be an important document to have available.

Re: SCA FAQ link at clojure.org/contributing....

2010-12-21 Thread Laurent PETIT
Indeed, this has been a problem for me too. I also tried to get it via the backdoors, e.g. via the Open JDK, Netbeans, etc., websites, but they did respect the DRY principle correctly, and all I found was just links to the missing page :-/ 2010/12/21 Mike Meyer

Re: SCA FAQ link at clojure.org/contributing....

2010-12-21 Thread Ken Wesson
On Tue, Dec 21, 2010 at 3:43 PM, Laurent PETIT laurent.pe...@gmail.com wrote: Indeed, this has been a problem for me too. I also tried to get it via the backdoors, e.g. via the Open JDK, Netbeans, etc., websites, but they did respect the DRY principle correctly, and all I found was just links

Re: Community attitude

2010-12-21 Thread kovas boguta
Simpler solution: Don't feed the trolls. We know who they are. On Tue, Dec 21, 2010 at 5:36 AM, Jay Fields j...@jayfields.com wrote: I was involved with Ruby and Rails in the early days. The Ruby mailing lists / conferences were always kind / helpful and the Rails lists / confs were always

Re: Native Clojure

2010-12-21 Thread Andrew Boekhoff
Lazy-seq's are often handy in Clojure to subvert the stack limit imposed by the the JVM, but it's not quite the same problem that TCO solves. Having recently converted some Scheme that leaned heavily on the presence of TCO, I'm curious as to what situations you think could not be solved

Re: SCA FAQ link at clojure.org/contributing....

2010-12-21 Thread Alex Miller
Darn. I actually noticed this and redirected to a better link at the beginning of November but it seems to have gone broken again. The best alternative I can seem to find right now is this: http://oss.oracle.com/oca-faq.pdf I've updated the page with this for now. Alex On Dec 21, 2:39 pm,

Re: SCA FAQ link at clojure.org/contributing....

2010-12-21 Thread Meikel Brandmeyer
Hi, Am 21.12.2010 um 22:00 schrieb Laurent PETIT: Now yes, and no, no more chances :-( Seems the link is fixed? http://oss.oracle.com/oca-faq.pdf Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Community attitude

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 8:36 AM, Jay Fields j...@jayfields.com wrote: I was involved with Ruby and Rails in the early days. The Ruby mailing lists / conferences were always kind / helpful and the Rails lists / confs were always hit and miss. There were plenty of great Rails people, and enough

Re: Community attitude

2010-12-21 Thread lance bradley
Some good guidelines to foster communities: http://freenode.net/channel_guidelines.shtml On Dec 21, 1:15 pm, David Nolen dnolen.li...@gmail.com wrote: On Tue, Dec 21, 2010 at 8:36 AM, Jay Fields j...@jayfields.com wrote: I was involved with Ruby and Rails in the early days. The Ruby mailing

Re: Community attitude

2010-12-21 Thread lprefontaine
Great Kevin, you just poured more oil on the fire... Code is not the only thing about Clojure. Getting newbies on board is needed and if they need pointers fine with me. There has to be a place to jump start people. This mailing is a starting point and has to be somewhat friendly. I myself can

Re: Native Clojure

2010-12-21 Thread David Nolen
On Tue, Dec 21, 2010 at 4:01 PM, Andrew Boekhoff boekho...@gmail.comwrote: (defn [f k x] (if (time-to-return? x) (k x) (g (fn [x*] (k (do-stuff-to x*))) x))) (defn [g k x] (if (time-to-return? x) (k x) (f (fn [x*] (k (do-other-stuff-to x*))) x))) No, great

Re: ANN: Clojure web application using NHPM for server push

2010-12-21 Thread Anders Rune Jensen
On Mon, Dec 20, 2010 at 6:06 PM, rob levy r.p.l...@gmail.com wrote: I have posted a repository containing the code for a web application I made using a server push (AKA Comet, long polling) architecture.  The front end is in Javascript, and the back end is in Clojure.  The clojure code is able

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Phil Hagelberg
On Dec 21, 10:35 am, Alyssa Kwan alyssa.c.k...@gmail.com wrote: What about when I need to delete a unit test?  Reloading the test buffer doesn't remove it, and I need to either restart swank or reconnect slime, or manually remove those tests using (unmap-ns). Surely there's a better way... If

Software Transactional Memory video

2010-12-21 Thread Tim Daly
This is another view of the Clojure STM idea, from the Haskell camp: http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory Recently, we visited MSR Cambridge(UK) to meet some of the great minds working there. In this case, we were

Re: Community attitude

2010-12-21 Thread Ken Wesson
On Tue, Dec 21, 2010 at 7:47 PM, Tim Robinson tim.blacks...@gmail.com wrote: In my humble opinion, I don't think what you're experiencing will get any better, but here are a few thoughts: 1. You can still enjoy the community by changing your expectations and adopting 1 single rule (which I

My first Clojure program: request for code review

2010-12-21 Thread Marek Kubica
Hi, I wrote a small log file analyzer for IRC logs. We use nickname++ and nickname-- to track the karma, so after trying to write it in JavaScript (failed due to to the fact that Gjs/Seed are unmature yet), Factor (failed because I am just too stupid to understand it), Guile (failed because I ran

Re: Community attitude

2010-12-21 Thread Tim Robinson
You might be interested to google fundamental attribution error. After a briefly read on Wikipedia, I'm glad you pointed that out. I'll read more. Any other comment I could make on that seems to open too many doors to discussions not related to Clojure, but thank you for sharing. As for the

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Alyssa Kwan
Awesome!!! This absolutely does the trick! On Dec 21, 7:16 pm, Phil Hagelberg p...@hagelb.org wrote: On Dec 21, 10:35 am, Alyssa Kwan alyssa.c.k...@gmail.com wrote: What about when I need to delete a unit test?  Reloading the test buffer doesn't remove it, and I need to either restart

Re: Error Handling for Callback API to Blocking API example in Joy of Clojure

2010-12-21 Thread Chouser
On Sun, Dec 19, 2010 at 3:36 AM, HiHeelHottie hiheelhot...@gmail.com wrote: In Joy of Clojure, there is a callback API to blocking API example in the section on promises.  Chouser outlines it a briefly in a discussion on Promise/Deliver use cases here -

Re: My first Clojure program: request for code review

2010-12-21 Thread Benny Tsai
Hi Marek, Here's my tweaked version: (ns karma (:use [clojure.contrib.duck-streams :only (read-lines)]) (:use [clojure.contrib.generic.functor :only (fmap)])) (def allowed-nickname [A-z]{1,16}) (def upvote-regexp (re-pattern (format (%s)\\+\\+ allowed- nickname))) (def downvote-regexp

Re: My first Clojure program: request for code review

2010-12-21 Thread Justin Kramer
Here's my version. Main points: * Use with-open line-seq for worry-free laziness * Do everything in one swoop (reduce) * Perform one regexp match per line * Leverage - ;; (ns user (use [clojure.java.io :only [reader]])) (def re-vote #([A-z]{1,16})(\+\+|\-\-)) (defn extract-votes [line]

Mocking multimethods

2010-12-21 Thread Alyssa Kwan
Hi everyone, Does anyone have any experience in mocking multimethods? I'm working on a version control framework modeled after Git: (def ^{:private true} patches- (ref []) (defn patches [] (seq @patches-)) (defn do-patch! [fn args] (dosync (apply fn args) (let [patch {:fn fn

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Michael Ossareh
On Tue, Dec 21, 2010 at 16:16, Phil Hagelberg p...@hagelb.org wrote: It also highlights failures in the test buffer for better feedback. when there is a failure where are the details of the failure printed out to? I love that the highlight shows me which test have errors, but since I've moved

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Michael Ossareh
On Tue, Dec 21, 2010 at 21:36, Michael Ossareh ossa...@gmail.com wrote: On Tue, Dec 21, 2010 at 16:16, Phil Hagelberg p...@hagelb.org wrote: It also highlights failures in the test buffer for better feedback. when there is a failure where are the details of the failure printed out to? I

Re: Mocking multimethods

2010-12-21 Thread Alex Baranosky
Hi Alyssa, Using the midje library I was able to do your first test. I'm pretty tired so I this might be it for the night. (fact throws an error if can't resolve undo function (undo-patch [2]) = (throws IllegalArgumentException No method in multimethod 'undo-fn' for dispatch value: null)) Is

Re: Mocking multimethods

2010-12-21 Thread Alex Baranosky
So I lied, I couldn't resist doing just one more: (defn some-fn [] nil) (fact calls the anonymous function that undo-fn returns (undo-patch ...patch...) = @patches- (provided (undo-fn ...patch...) = some-fn (some-fn) = nil)) The two provided statements are mboth mocking and