Re: Does macros evaluates its arguments before?

2011-09-28 Thread ru
Dear Michal, You and others explain me how Clojure (or Common Lisp) handles my code. Very detailed and thoroughly. I want to draw attention to another point: The documentation says that the macro function is called with the arguments unevaluated. So I write code for that function on that

Re: iterate with side-effect function?

2011-09-28 Thread Jonathan Fischer Friberg
How about while? (while not-finished (do stuff ...)) On Wed, Sep 28, 2011 at 4:23 AM, Nathan Sorenson n...@sfu.ca wrote: Quite often I convince myself I need state or some effectful trigger, but further thought reveals a simpler stateless approach. That being said--if you absolutely need

Re: Does macros evaluates its arguments before?

2011-09-28 Thread Baishampayan Ghose
On Wed, Sep 28, 2011 at 2:27 PM, ru soro...@oogis.ru wrote: The documentation says that the macro function is called with the arguments unevaluated. So I write code for that function on that assumption. And when I run this code the arguments being evaluated. It does not matter why or how and

Re: Does macros evaluates its arguments before?

2011-09-28 Thread ru
If the macro arguments are evaluated, the macro does not need to expand the language. All you can do with functions: (eval-some-code '(.. some code here ..)) Even VisualBasic can do this: eval_some_code .. some code here .. On 28 сен, 12:57, ru soro...@oogis.ru wrote: Dear Michal, You and

Re: Does macros evaluates its arguments before?

2011-09-28 Thread Baishampayan Ghose
On Wed, Sep 28, 2011 at 2:39 PM, ru soro...@oogis.ru wrote: If the macro arguments are evaluated, the macro does not need to expand the language. All you can do with functions: (eval-some-code '(.. some code here ..)) Even VisualBasic can do this: eval_some_code .. some code here .. Try

Re: Does macros evaluates its arguments before?

2011-09-28 Thread Michał Marczyk
You know, in many Lisps let is a macro too. In Clojure it expands to the special form let* (an implementation detail); a Scheme implementation might implement it as ((lambda (binding-symbol ...) expr . exprs) binding-val ...). Now, would you expect the following to return (inc x) -- a list of two

Re: Does macros evaluates its arguments before?

2011-09-28 Thread ru
Baishampayan! Thank you very much! Your explanation is best. At last I understand my gap in understanding of the situation. Sincerely, Ru On 28 сен, 13:06, Baishampayan Ghose b.gh...@gmail.com wrote: On Wed, Sep 28, 2011 at 2:27 PM, ru soro...@oogis.ru wrote: The documentation says that

Re: Does macros evaluates its arguments before?

2011-09-28 Thread Baishampayan Ghose
2011/9/28 ru soro...@oogis.ru: Thank you very much! Your explanation is best. At last I understand my gap in understanding of the situation. Extremely happy to to have helped you, Ru. Please don't hesitate to email us if you have more questions. Regards, BG -- Baishampayan Ghose b.ghose at

Re: Does macros evaluates its arguments before?

2011-09-28 Thread ru
On 28 сен, 13:13, Michał Marczyk michal.marc...@gmail.com wrote: You know, in many Lisps let is a macro too. In Clojure it expands to the special form let* (an implementation detail); a Scheme implementation might implement it as ((lambda (binding-symbol ...) expr . exprs) binding-val ...).

Re: suggestion for clojure development

2011-09-28 Thread Gary Poster
On Sep 28, 2011, at 1:26 AM, Sean Corfield wrote: On Wed, Sep 28, 2011 at 12:03 AM, Arthur Edelstein arthuredelst...@gmail.com wrote: You may think I'm doing it wrong, but I don't think I'm alone at all. I don't think you're doing anything wrong - and I'm sure many people only do minimal

Re: suggestion for clojure development

2011-09-28 Thread Baishampayan Ghose
On Wed, Sep 28, 2011 at 5:00 PM, Gary Poster gary.pos...@gmail.com wrote: Perhaps Java has been different, but the languages I use and follow have not, with the exception of JavaScript.  I perceive it to be a mildly unfortunate fact of life at this point. JavaScript's case might seem

A question about arity and function performance

2011-09-28 Thread Christian Romney
I was reading the implementation of juxt and noticed it is defined with 4 arities: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L2296 Am I right to infer this is for performance reasons? Where can I read more about the performance implications of arity and this sort of

Re: A question about arity and function performance

2011-09-28 Thread David Nolen
Specific arities means dispatch on arity can happen at the full speed of the host w/o incurring the overhead of variable arity support. This issue applies to ClojureScript as well where functions are not backed by classes. David On Wed, Sep 28, 2011 at 8:55 AM, Christian Romney xmlb...@gmail.com

Re: suggestion for clojure development

2011-09-28 Thread Nicolas
On Sep 28, 1:30 pm, Gary Poster gary.pos...@gmail.com wrote: On Sep 28, 2011, at 1:26 AM, Sean Corfield wrote: Perhaps Java has been different, but the languages I use and follow have not, with the exception of JavaScript.  I perceive it to be a mildly unfortunate fact of life at this

Re: suggestion for clojure development

2011-09-28 Thread Islon Scherer
I agree with Nicolas, clojure should, at this point, focus on improving the language instead of maintain compatibility, and as most features of other languages can be implemented as macros I think clojure is ahead of the competition. -- You received this message because you are subscribed to

Re: statistics library?

2011-09-28 Thread Daniel
Depending on the project (and I don't know if it's still supported in 1.3), you ought to be able to leverage Mathematica Player with Clojuratica for more powerful operations. On Sep 27, 6:43 pm, Lee Spector lspec...@hampshire.edu wrote: On Sep 27, 2011, at 5:44 PM, David Powell wrote: I see

True diff on any Clojure struct

2011-09-28 Thread Michael Jaaka
Do you know any lib for making diff from nested structures? (diff [ 1 2 3 { 2 3 4 [ 1 2 { 1 2 3 4} ] } #{ 4 5 } ] [ 1 3 { 2 3 4 [ 1 4 { 2 2 3 5} ] } #{ 4 5 } ] ) - [ 2 { [ 2 { 1 2 3 4 } ] } ] as you can see it behaves like clojure.set/difference and better if you would point the keys in map

Re: True diff on any Clojure struct

2011-09-28 Thread Baishampayan Ghose
On Wed, Sep 28, 2011 at 7:29 PM, Michael Jaaka michael.ja...@googlemail.com wrote: Do you know any lib for making diff from nested structures? (diff [ 1 2 3 { 2 3 4 [ 1 2 { 1 2 3 4} ] } #{ 4 5 } ]  [ 1 3 { 2 3 4 [ 1 4 { 2 2 3 5} ] } #{ 4 5 } ] ) - [ 2 { [ 2 { 1 2 3 4 } ] } ] as you can see it

Re: iterate with side-effect function?

2011-09-28 Thread siyu798
Odyssomay, While does not work in this case as ctx will be updated on each iteration and fed to the next iteration. Thanks, siyu -- 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: iterate with side-effect function?

2011-09-28 Thread Meikel Brandmeyer (kotarak)
Hi, there is ye olde loop/recur, which handles side effects (and this case in particular) quite nicely. The only advantage of iterate is that the sequence of intermediate values is available to an outside observer. However, as stated before: mixing lazy sequences with side effects is asking

Re: Clojurescript output effect

2011-09-28 Thread Brent Millare
Ah, figured it out. First, its important to use the debugging tools in chrome when working on javascript (Shift+Ctrl+I). This gave me the error I needed to figure what was going wrong. The problem was I needed the goog.addDependency line. Now it knows where to find it and doesn't cause an error.

Re: Clojurescript output effect

2011-09-28 Thread Brent Millare
@David Nolen, All the files are there in the script tab. autogen'd file out/F6baq.js: goog.provide('hello'); goog.require('cljs.core'); hello.greet = (function greet(){ return hello world; }); goog.exportSymbol('hello.greet', hello.greet); hello.js: goog.addDependency(../cljs/core.js,

Re: Clojurescript output effect

2011-09-28 Thread David Nolen
Does it work when you use the advanced compilation settings? On Wed, Sep 28, 2011 at 12:35 PM, Brent Millare brent.mill...@gmail.comwrote: @David Nolen, All the files are there in the script tab. autogen'd file out/F6baq.js: goog.provide('hello'); goog.require('cljs.core'); hello.greet =

Re: Clojurescript output effect

2011-09-28 Thread Brent Millare
No, I get a similar error, but instead of hello not being defined, it says b is not defined. On Sep 28, 12:55 pm, David Nolen dnolen.li...@gmail.com wrote: Does it work when you use the advanced compilation settings? On Wed, Sep 28, 2011 at 12:35 PM, Brent Millare

Re: Clojurescript output effect

2011-09-28 Thread David Nolen
Did you try this wIthout a single element namespace? On Wednesday, September 28, 2011, Brent Millare brent.mill...@gmail.com wrote: No, I get a similar error, but instead of hello not being defined, it says b is not defined. On Sep 28, 12:55 pm, David Nolen dnolen.li...@gmail.com wrote: Does

break-on-gaps - just curious if there is a more idiomatic way to do this

2011-09-28 Thread qhfgva
I've been working on problems from Programming Challenges (Skiena) to learn clojure. As part of a problem I developed the following routine. I sort of scare myself how natural thinking in reduce is getting, but I was wondering if there is a more clever/idiomatic way to solve this problem. (defn

Re: Clojurescript output effect

2011-09-28 Thread Brent Millare
Hi David, I'm not sure what you mean by this. If I replace hello.greet() with greet(), I get greet is not defined instead. On Sep 28, 2:03 pm, David Nolen dnolen.li...@gmail.com wrote: Did you try this wIthout a single element namespace? On Wednesday, September 28, 2011, Brent Millare

Re: Clojurescript output effect

2011-09-28 Thread David Nolen
Change you project layout to something like this: src/hello/core.cljs And put the code currently in hello.cljs in core.cljs Make the other relevant changes to account for this restructuring. Whenever I encounter issues like the one you're experiencing I try to compare against the working

Idiomatically returning one or two values from a function.

2011-09-28 Thread Daniel Pittman
G'day. I have problem that I have been thrashing back and forth over the best design of for a week now, and I can't work out the nicest way to handle it. Specifically, I have a collection of functions that return a primary result, and might also return a secondary annotation about that result.

Re: iterate with side-effect function?

2011-09-28 Thread siyu798
Thanks everyone. -- 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 be patient with your first post. To unsubscribe from this group,

Re: Idiomatically returning one or two values from a function.

2011-09-28 Thread Daniel Solano Gomez
On Wed Sep 28 18:52 2011, Daniel Pittman wrote: G'day. I have problem that I have been thrashing back and forth over the best design of for a week now, and I can't work out the nicest way to handle it. Specifically, I have a collection of functions that return a primary result, and might

Re: Idiomatically returning one or two values from a function.

2011-09-28 Thread Meikel Brandmeyer
Hi, you can return always a vector. (fn [] [true]) (fn [] [true {:foo 12}]) And then use destructuring on the return value. (let [[value annotations] (...)] (when annotations ..)) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure

Re: Shameless self promotion - JavaOne

2011-09-28 Thread Sean Corfield
The Bay Area Clojure User Group is scheduled to meet on Thursday October 6th. Any out of town Clojurians who would be around for that meetup and might be persuaded to come and talk about what they're doing with Clojure? http://www.meetup.com/The-Bay-Area-Clojure-User-Group/ Sean On Tue, Sep 27,

Re: break-on-gaps - just curious if there is a more idiomatic way to do this

2011-09-28 Thread Nathan Sorenson
If you were feeling so inclined, you could structure this as a lazy sequence (like 'partition' does) (defn lazy-break [coll] (letfn [(break-paired [pairs] (lazy-seq (when-let [s (seq pairs)] (let [p (doall (take-while (fn [[a b]] (= (inc a) b)) pairs))

Are futures garbage-collected?

2011-09-28 Thread Jan Rychter
If I create a future but do not hold on to it anywhere and never dereference it, is the thread guaranteed to run until successful completion? In other words, if I create futures entirely for side effects, should I worry about them getting terminated and GCd? I looked for an answer but could

Re: Are futures garbage-collected?

2011-09-28 Thread Matt Hoyt
It won't get GC until it finishes running unless the thread throws an unhandled Exception or the application is terminated.   Matt Hoyt From: Jan Rychter jrych...@gmail.com To: clojure@googlegroups.com Sent: Wednesday, September 28, 2011 3:38 PM Subject: Are

Re: Are futures garbage-collected?

2011-09-28 Thread Mark
The future object itself is garbage collected but the thread is not, so you should be ok. -- 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 -

Re: break-on-gaps - just curious if there is a more idiomatic way to do this

2011-09-28 Thread Alan Malloy
I wrote a generalized version of this called partition-between, which you can see at https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L181 if you're interested. Using that as a primitive, your break-on-gaps function is simple: user (partition-between (fn [[a b]] (not= a (dec

Re: Are futures garbage-collected?

2011-09-28 Thread Michael Jaaka
I'm using futures for queuing jobs to stress test a server, multiple processess,each reciving and futuring job. Works as expected for many days with no problems in cpu and mem usage... Clojure rox. On 28 Wrz, 22:48, Mark markaddle...@gmail.com wrote: The future object itself is garbage

seeking advice for reducing boilerplate

2011-09-28 Thread Andrew
While trying out clj-webdriver (for testing web pages), I got the impulse to reduce some of my boilerplate. I'd like your advice on best practices. Here's the original code. (deftest test-login (let [b (start :firefox https://github.com;)] (try (implicit-wait b 6) (- b

Who will be at QCon SF?

2011-09-28 Thread Demetrius Nunes
Hi guys, I'd love to meet with fellow clojurians at QCon SF. How many of you will be there? cheers! Demetrius -- 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: [ANN] Clojure 1.3 Released

2011-09-28 Thread Sidharth Kshatriya
Hi Sean, Intrigued by your statement that: On Wed, Sep 28, 2011 at 3:17 AM, Sean Corfield seancorfi...@gmail.comwrote: [...] We've converted all of our profile publishing and searching code to Clojure now (from Scala and CFML respectively) and we're liking the initial results we're seeing

Re: Shameless self promotion - JavaOne

2011-09-28 Thread Boris Mühmer
Will there be any slides or maybe even a recording of this session? I would be very interested in this talk, but I can't go there... Regards, Boris 2011/9/27 Dennis shr3ks...@gmail.com: Hey guys, I will be giving a talk at JavaOne (it is Clojure related).  Here is the information.

Type inheritance, porting from Java

2011-09-28 Thread toxi
Dear Clojurians, I picked up Clojure a few months ago and find it hugely fascinating. I've been working mainly with Java for the past few years and now trying to overcome the un-learning curve in regards to polymorphism and solving it with records protocols instead. My aim is to port my library

how do I use data.priority-map

2011-09-28 Thread Sunil S Nandihalli
Hello everybody, can somebody help me figure out what I should add to my project.clj to use https://github.com/clojure/data.priority-map I am using clojure 1.3. Thanks, Sunil. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: how do I use data.priority-map

2011-09-28 Thread Sunil S Nandihalli
after I posted the question .. I found this discussionhttp://groups.google.com/group/clojure-dev/browse_thread/thread/de04e7d6c1a8cfa4?pli=1 . So, I guess it is not ready for prime-time yet .. (may be I am wrong) Thanks, Sunil. On Thu, Sep 29, 2011 at 3:34 AM, Sunil S Nandihalli

Re: [ANN] Clojure 1.3 Released

2011-09-28 Thread Sean Corfield
On Tue, Sep 27, 2011 at 9:21 PM, Sidharth Kshatriya sid.kshatr...@gmail.com wrote: Can you tell me why Clojure scored over Scala for you. For my Scala / Clojure anecdote, see: http://groups.google.com/group/clojure/browse_thread/thread/b18f9006c068f0a0/ We like CFML for View templating and

Re: seeking advice for reducing boilerplate

2011-09-28 Thread Kevin Downey
the browser bit should really use with-open (with-open [browser (create-browser :firefox)] On Wed, Sep 28, 2011 at 4:32 PM, Andrew ache...@gmail.com wrote: While trying out clj-webdriver (for testing web pages), I got the impulse to reduce some of my boilerplate. I'd like your advice on best

Re: Shameless self promotion - JavaOne

2011-09-28 Thread Dennis
I am not sure to what extent there will be recording. However, I can send you my slides after the presentation. -- Dennis On Wed, Sep 28, 2011 at 12:47 AM, Boris Mühmer boris.mueh...@googlemail.com wrote: Will there be any slides or maybe even a recording of this session? I would be very

Re: how do I use data.priority-map

2011-09-28 Thread Mark Engelberg
I see it here: https://oss.sonatype.org/content/groups/public/org/clojure/ so based on the version number here: https://oss.sonatype.org/content/groups/public/org/clojure/data.priority-map/ I assume it can be added to one's project with a version number of 0.0.1-SNAPSHOT I'm still trying to

Re: how do I use data.priority-map

2011-09-28 Thread Sean Corfield
No builds have yet been released to Maven. You can, however, use the snapshot from Sonatype. Add the following to project.clj: :repositories {sonatype-oss-public https://oss.sonatype.org/content/groups/public/} That causes Leiningen to search the Sonatype repository. Then add this

Re: suggestion for clojure development

2011-09-28 Thread Arthur Edelstein
I think that clojure/core team is doing its best to ensure backward compatibility and break it only when there are prevalent reasons to do it. So what's the plan for the future? Are there plans to make clojure stable at some point so that backward compatibility can be expected? Otherwise I am

Re: seeking advice for reducing boilerplate

2011-09-28 Thread Eric Lavigne
While trying out clj-webdriver (for testing web pages), I got the impulse to reduce some of my boilerplate. I'd like your advice on best practices. I would start with the main test macro, web-test. I would replace your local variable b with a dynamically bound var *browser* that web-test is

Re: suggestion for clojure development

2011-09-28 Thread cran1988
Improve as much as possible , performances and memory management !! -- 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 be patient

Re: suggestion for clojure development

2011-09-28 Thread Michael Gardner
On Sep 28, 2011, at 7:20 PM, Arthur Edelstein wrote: So what's the plan for the future? Are there plans to make clojure stable at some point so that backward compatibility can be expected? Otherwise I am going to have difficulty continuing to advocate clojure to my colleagues. In other words,

help understanding how map works

2011-09-28 Thread Cluj
I am learning Clojure and have installed Clojure 1.2.0 in an Ubuntu 11 box. While playing with the map function I ran into some behavior I don't understand. I tried to use map to change a list of strings into a list of vectors of strings, something like: (A B C) = ( [ A] [B] [C]) Inlining the

Re: Type inheritance, porting from Java

2011-09-28 Thread David Nolen
There is no convenient way to inherit functionality. But there are a couple other routes, perhaps one of these will appeal to you - * Just use your rich Java library from Clojure, perhaps providing a high performance integration the same way that Clojure does via RT.java and inlining * Use macros

Re: help understanding how map works

2011-09-28 Thread Mark Engelberg
#([ % ]) is like: (defn wrap [ x ] ([ x ]) ) not (defn wrap [ x ] [ x ] ) -- 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 be patient

Re: help understanding how map works

2011-09-28 Thread Cluj
Thank you! Obvious once someone explains it :) On Sep 28, 6:13 pm, Mark Engelberg mark.engelb...@gmail.com wrote: #([ % ]) is like: (defn wrap [ x ] ([ x ]) ) not (defn wrap [ x ] [ x ] ) -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: help understanding how map works

2011-09-28 Thread Sean Corfield
On Wed, Sep 28, 2011 at 6:32 PM, Cluj alex.sant...@gmail.com wrote: Thank you! Obvious once someone explains it :) You could also do: (map vector '(A B C)) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo

error after install java IO file not found

2011-09-28 Thread jayvandal
I installed clojure from Programming Clojure page 12. I try to run snake.clj. This is what I get What causes this?? Thanks == C:\clojure-1.3.0java -jar c:/clojure-1.3.0/clojure-1.3.0.jar c:/clojure-1.2.1/e xamples/snake.clj Exception in