Re: Nil Coalesce

2010-08-18 Thread Michael Wood
On 18 August 2010 04:44, Justin Kramer jkkra...@gmail.com wrote: On Aug 17, 4:42 pm, Alan a...@malloys.org wrote: Devious! The OP wanted to handle underflow of the subs collection though, so you need a tweak: (apply assoc v (interleave (positions nil? v)                            (concat

Program design

2010-08-18 Thread prishvin
Dear Friends, I am thinking about porting my existing program to clojure. Is there any way of designing equivalents to classes with simple inheritance? For e.g. if I have base class fruit and derived classes apple and orange. The OOP design gives me a possibility to handle those object in the

Re: Program design

2010-08-18 Thread Mark Engelberg
I think the easiest way to port OO code would be to use Clojure's multimethods, dispatching on the type of the first argument. -- 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

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-18 Thread Steve Purcell
On 17 Aug 2010, at 21:21, Steve Molitor wrote: Sorry my message got truncated. Let's try again: Fuzzy completion (ac-source-slime-fuzzy) isn't working for me. It complains that the function slime-fuzzy-completions is not defined. I'm using slime.el version 2010404, which does not

Re: multiline strings and multiline comments ?

2010-08-18 Thread Zmitro Lapcjonak
On Aug 17, 12:14 am, Lee Spector lspec...@hampshire.edu wrote: On Aug 16, 2010, at 4:13 PM, Meikel Brandmeyer wrote: Every descent editor should provide a comment-selected-text functionality. I've worked in several editors that have comment-selected-text, but I don't see it in

Simple question about name-spaces

2010-08-18 Thread Nicolas Oury
Dear all, I have a simple problem I can't manage to solve. I have a library of multiple namespaces( a b c) that I want to include in one namespace lib, so user of the library can only use/require lib and have access to all the functions i a, b and c. What is the standard way to do that? Best,

Re: Simple question about name-spaces

2010-08-18 Thread Meikel Brandmeyer
Hi, On 18 Aug., 11:49, Nicolas Oury nicolas.o...@gmail.com wrote: I have a library of multiple namespaces( a b c) that I want to include in one namespace lib, so user of the library can only use/require lib and have access to all the functions i a, b and c. What is the standard way to do

Re: Clojure Web Programming group?

2010-08-18 Thread Shantanu Kumar
+1 Neat idea. Starting a Google group Clojure web development might be a solution. Regards, Shantanu On Aug 18, 2:05 am, Rasmus Svensson r...@lysator.liu.se wrote: I think there's a lot of questions that a Clojure programmer faces when doing web programming, not only regarding how the

Re: Simple question about name-spaces

2010-08-18 Thread Nicolas Oury
That helps a lot. Thank you very much. That is not very nice though. I quite would like a :reexport option to use. Best, Nicolas. On Wed, Aug 18, 2010 at 11:17 AM, Meikel Brandmeyer m...@kotka.de wrote: There is no standard way of doing that. There is immigrate of an old Compojure version,

Re: Clojure Web Programming group?

2010-08-18 Thread Chris Jenkins
Great idea. I'm trying to figure out web development in Clojure atm and a group to specifically talk about this area would be great. On 18 August 2010 11:20, Shantanu Kumar kumar.shant...@gmail.com wrote: +1 Neat idea. Starting a Google group Clojure web development might be a solution.

Re: Simple question about name-spaces

2010-08-18 Thread Adrian Cuthbertson
Hi Nicolas, I've done a bit of manipulation of namespaces for dynamic loading and executing of functions in a web app context which might give you some ideas... Here ns-nm and ipath have been extracted from a url. Then... (let [ . ipath (if (or (nil? ipath) (= ipath )) root ipath) ipath

Re: Simple question about name-spaces

2010-08-18 Thread Nicolas Oury
If you intern all the ns-public variable of a namespace, they will be reexoprted? Will there be an indirection at runtime or the JVM can sort that out? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-18 Thread MHOOO
I'm experiencing the exact same problem. Haven't found a way to fix this yet. On 17 Aug., 04:38, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, just yesterday I took a first look at auto-complete together with your slime auto completion sources. I'm encountering some Exceptions,

Re: Nil Coalesce

2010-08-18 Thread Justin Kramer
On Aug 18, 2:42 am, Michael Wood esiot...@gmail.com wrote: nils replace nils when there are fewer substitutions than nil positions was one of the requirements. From the first post: If nil is encountered in the first sequence and the second sequence is exhaused, nil will be returned:

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-18 Thread Steve Purcell
On 18 Aug 2010, at 13:51, MHOOO wrote: I'm experiencing the exact same problem. Haven't found a way to fix this yet. I've fixed the problem in my fork of swank-clojure and requested that Phil pull the commit into the master repo:

accessing a mutable field outside of a deftype

2010-08-18 Thread Nicolas Oury
This works (deftype A [a]) (.a (A. 5)) This don't (deftype A [^{:volatile-mutable true} a]) (.a (A. 5)) Is this normal? Is this a bug? How could I access the field? Best, Nicolas. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: accessing a mutable field outside of a deftype

2010-08-18 Thread David Nolen
On Wed, Aug 18, 2010 at 10:06 AM, Nicolas Oury nicolas.o...@gmail.comwrote: This works (deftype A [a]) (.a (A. 5)) This don't (deftype A [^{:volatile-mutable true} a]) (.a (A. 5)) Is this normal? Is this a bug? How could I access the field? Best, Nicolas. It's not a bug. You

Today's clojure trick question

2010-08-18 Thread Brian Hurt
Consider the following bit of code: (let [ x (new java.lang.Boolean false) ] (if x trouble ok)) As you might guess from the fact that I'm calling it's a trick question, the above code returns trouble, not ok. From experimentation, it looks like clojure's if takes the second branch if the value

Re: Today's clojure trick question

2010-08-18 Thread Nicolas Oury
(defmacro fat-if) On Wed, Aug 18, 2010 at 4:09 PM, Brian Hurt bhur...@gmail.com wrote: Consider the following bit of code: (let [ x (new java.lang.Boolean false) ] (if x trouble ok)) As you might guess from the fact that I'm calling it's a trick question, the above code returns trouble,

Re: accessing a mutable field outside of a deftype

2010-08-18 Thread Nicolas Oury
And they need to be in an interface first? -- 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

Re: Today's clojure trick question

2010-08-18 Thread David Nolen
On Wed, Aug 18, 2010 at 11:09 AM, Brian Hurt bhur...@gmail.com wrote: This is, however, more than a little bit surprising and depressing. Somewhere, in my 10K lines of clojure code, boolean values are getting boxed in exactly that way. I've fixed the current problem (dropping in a call to

Re: Simple question about name-spaces

2010-08-18 Thread Adrian Cuthbertson
Here's an approach that might work... ; app1.clj (ns app1) (defn myinc[x] (inc x)) (defn mydec[x] (dec x)) (defn .) ;app2.clj (ns app2) (defn mysq[x] (* x x)) then you have a mylib.clj which is your public user module; (ns mylib) (require 'app1 'app2) (defn exports[] (refer 'app1 :only

Re: Today's clojure trick question

2010-08-18 Thread Chouser
On Wed, Aug 18, 2010 at 11:09 AM, Brian Hurt bhur...@gmail.com wrote: Consider the following bit of code: (let [ x (new java.lang.Boolean false) ] (if x trouble ok)) The Javadoc for Boolean has something to say on this subject[1] as does the following excerpt from Fogus' book The Joy of

Re: accessing a mutable field outside of a deftype

2010-08-18 Thread Nicolas Oury
And is the one that works (for non-mutable fields) reliable or just an implementation accident that could change in the future? On Wed, Aug 18, 2010 at 4:27 PM, Nicolas Oury nicolas.o...@gmail.com wrote: And they need to be in an interface first? -- You received this message because you are

Multi-field sorting: juxt and sort-by

2010-08-18 Thread luskwater
This is a helpful hint, and probably one that others are already using, but seemed good to share. If you're sorting a list of maps on one field, you can use (sort-by :community list-of-residents) But sorting on two (or more) fields seems to require a little more coding: (sort-by

Re: accessing a mutable field outside of a deftype

2010-08-18 Thread David Nolen
On Wed, Aug 18, 2010 at 11:41 AM, Nicolas Oury nicolas.o...@gmail.comwrote: And is the one that works (for non-mutable fields) reliable or just an implementation accident that could change in the future? I'm assuming it's reliable for 1.2.0. -- You received this message because you are

Re: Today's clojure trick question

2010-08-18 Thread Brian Hurt
On Wed, Aug 18, 2010 at 11:34 AM, David Nolen dnolen.li...@gmail.comwrote: On Wed, Aug 18, 2010 at 11:09 AM, Brian Hurt bhur...@gmail.com wrote: This is, however, more than a little bit surprising and depressing. Somewhere, in my 10K lines of clojure code, boolean values are getting boxed in

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

2010-08-18 Thread michele
Wouldn't that make it easier to keep track of them. Example: (defn myfn-a [a b] (if (zero? b) a (recur (afn (bfn (...)) a) (dec b (defn myfn-b [a b] (if (zero? b) a (recur (afn (bfn (...)) a) (dec b) ) ) ) -- You received this message

Wrong package name of record classes

2010-08-18 Thread abhinav sarkar
Hi, I noticed that when I define a record (using defrecord) in a namespace having hyphen in its name (like abc.d-ef) and compile the clj file using AOT, a class file corresponding to the record defined is created in the package with the name same as the namespace it is defined in, with hyphen (in

Re: defprotocol not working?

2010-08-18 Thread Henrik Mohr
Ok, thanks for the answer. I actually have Leiningen installed, and I've just done a lein update - it's now on 1.2.0 as it says. Is this actually clojure 1.2.0, or just a stand-alone leiningen version? But I'm in the progress of just learning, so I don't want to have projects (yet). Because of

cool compiler-project?

2010-08-18 Thread Sreeraj a
Hi, I am a post-grad student looking for a cool compiler - project to do. I am getting comfortable with clojure and would really like to help Ideas anyone? or, Is there a to-do list where can i start? Cheers Sreeraj -- You received this message because you are subscribed to the Google Groups

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

2010-08-18 Thread Phil Hagelberg
On Wed, Aug 18, 2010 at 2:09 AM, michele michelemen...@gmail.com wrote: Wouldn't that make it easier to keep track of them. It would make it easier for people to keep track of them. However, keeping track of parentheses is not something people should be doing since it's menial, repetitive,

Re: Nil Coalesce

2010-08-18 Thread GrumpyLittleTed
My take is almost identical but I used the same length arguments for the collections which means that the difference in the if branch are easier to spot, at the cost of more cryptic argument names. This version will not blow the stack, and its easy to wrap in lazy-seq. (defn nil-coalesce [s1 s2]

Re: Today's clojure trick question

2010-08-18 Thread Andrew Gwozdziewycz
On Wed, Aug 18, 2010 at 11:09 AM, Brian Hurt bhur...@gmail.com wrote: Consider the following bit of code: (let [ x (new java.lang.Boolean false) ] (if x trouble ok)) I consider the fact that Boolean has a public constructor a bug. It can only ever represent 2 values. However, if you do (let

Re: Today's clojure trick question

2010-08-18 Thread David Nolen
On Wed, Aug 18, 2010 at 11:58 AM, Brian Hurt bhur...@gmail.com wrote: For the record, no where in my code am I deliberately creating Boolean objects. Why the hell would I write (new java.lang.Boolean false) when I can just as easily write false? And I have looked through the code to see if

Re: Today's clojure trick question

2010-08-18 Thread Nicolas Oury
I am not an expert. Is it possible on some JDK to put a breakpoint on Boolean constructor and look at the stack? Or you can't put a breakpoint on standard library? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Today's clojure trick question

2010-08-18 Thread Chas Emerick
No, you can put a breakpoint on any class, regardless of where it's been loaded from. In this case, I'd suggest not relying on the line numbers shown in source dumps. At least in my experience, line numbers in the standard library source differ from what is shown at runtime. All three Java IDEs

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

2010-08-18 Thread Sean Corfield
On Wed, Aug 18, 2010 at 2:09 AM, michele michelemen...@gmail.com wrote: (defn myfn-b [a b]  (if (zero? b)    a    (recur      (afn (bfn (...)) a)      (dec b)    )  ) ) I started out trying to do that but it ended up being far more work that it was worth - as Phil said, computer programs

Re: Nil Coalesce

2010-08-18 Thread Nicolas Oury
I have a solution : (defn unfold [f as] (if-let [[hd new-as] (apply f as)] (lazy-seq (cons hd (apply unfold f new-as))) ())) unfold could be called co-reduce or coreduce. It is the dual operation of reduce, in category theory. Instead of reducing a seq to create a value, it

Re: Clojure Web Programming group?

2010-08-18 Thread Marc Spitzer
its a good idea, so here it is: Congratulations: you've successfully created your Google Group, Clojure Web Development. Here are the essentials: * Group name: Clojure Web Development * Group home page: http://groups.google.com/group/clojure-web-dev * Group email address

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

2010-08-18 Thread Nicolas Oury
auto-indentation and parens highlighting are better than lines with only one parens. At least for me. There is no law. Do what is best for you. You might, or not, change your mind when you have more practice with all those parens. -- You received this message because you are subscribed to the

Re: Today's clojure trick question

2010-08-18 Thread Shantanu Kumar
Would suggest to consider this: (let [ x (true? (new java.lang.Boolean false)) ] (if x trouble ok)) Regards, Shantanu On Aug 18, 10:05 pm, Chas Emerick cemer...@snowtide.com wrote: No, you can put a breakpoint on any class, regardless of where it's been loaded from. In this case, I'd

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

2010-08-18 Thread Marc Spitzer
On Wed, Aug 18, 2010 at 1:11 PM, Sean Corfield seancorfi...@gmail.com wrote: On Wed, Aug 18, 2010 at 2:09 AM, michele michelemen...@gmail.com wrote: (defn myfn-b [a b]  (if (zero? b)    a    (recur      (afn (bfn (...)) a)      (dec b)    )  ) ) I started out trying to do that but it

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

2010-08-18 Thread Brian Goslinga
Putting them on separate lines put the focus on the wrong element of the code. You do not want to be focusing on the parentheses, you want to be focusing on the structure of the code. The idiomatic lisp formatting style uses indentation to reveal the large scale structure of the code, and so the

Re: Today's clojure trick question

2010-08-18 Thread Sean Corfield
On Wed, Aug 18, 2010 at 10:28 AM, Shantanu Kumar kumar.shant...@gmail.com wrote: Would suggest to consider this: (let [ x (true? (new java.lang.Boolean false)) ] (if x trouble ok)) Ah, but that wouldn't work for a new Boolean set to true: (let [ x (true? (new java.lang.Boolean true)) ] (if x

Re: defprotocol not working?

2010-08-18 Thread Nicolas Oury
You can create a new project, even if you don't use it: lein new experiments inside it will create a project.clj. Checks the dependencies look like that: :dependencies [[org.clojure/clojure 1.2.0-RC3] [org.clojure/clojure-contrib 1.2.0-RC3] Type lein deps in the directory.

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-18 Thread MHOOO
I can get rid of those errors by evaling this in the repl. Does this work for you as well?: (do (require 'clojure.contrib.with-ns) (clojure.contrib.with-ns/with-ns 'swank.commands.basic (defn- describe-to-string [var] {:pre [(var? var)]} (with-out-str (print-doc

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

2010-08-18 Thread Daniel E. Renfer
On 8/18/10 1:32 PM, Brian Goslinga wrote: Putting them on separate lines put the focus on the wrong element of the code. You do not want to be focusing on the parentheses, you want to be focusing on the structure of the code. The idiomatic lisp formatting style uses indentation to reveal the

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

2010-08-18 Thread Tim Daly
Three reasons. First, code density, that is the number of (/ number-of-lines-of-code number-of-lines-on-screen) should approach 1 so that every line on the screen is code. Second, real editors paren-bounce to show matching parens. Third, real lispers don't exit the thought process until the

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

2010-08-18 Thread Greg
It's almost purely community convention that has been adopted from Lisp. You may be interested in this link: http://gregslepak.posterous.com/on-lisps-readability There is much discussion about this topic there. Cheers, Greg On Aug 18, 2010, at 2:09 AM, michele wrote: Wouldn't that make it

ANN: SQLRat - A Clojure 1.2 library to access Relational Databases using DataTypes

2010-08-18 Thread Shantanu Kumar
Hi, I have uploaded source code (Apache 2 license) for SQLRat - a library for Clojure 1.2 to access relational databases using DataTypes (entities). It also lets you define relations between entities and navigate them. While this is a part of what typically Object- Relational Mapping (ORM)

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

2010-08-18 Thread Alan
The indentation is enough of a hint to get it right. For example, in myfn-a, because you've indented it correctly I can easily tell that (dec b) is the second argument to recur, without looking at the parentheses at all. Isolating close-parens would probably help a little with this task, but the

Re: Today's clojure trick question

2010-08-18 Thread Matt Fowles
All~ Boolean.valueOf() was added in 1.4. While that seems ancient, some older libraries use 'new Boolean()' because they maintain 1.2 compatibility. It seems like Clojure should take more care when it unboxes Booleans... Matt On Wed, Aug 18, 2010 at 12:57 PM, Nicolas Oury

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

2010-08-18 Thread Michael Gardner
On Aug 18, 2010, at 1:38 PM, Greg wrote: http://gregslepak.posterous.com/on-lisps-readability That article is dishonest. The author changes indentation widths between examples, while focusing entirely on the trailing-parens. He claims in a comment that the post is not solely about trailing

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

2010-08-18 Thread Greg
On Aug 18, 2010, at 12:07 PM, Michael Gardner wrote: On Aug 18, 2010, at 1:38 PM, Greg wrote: http://gregslepak.posterous.com/on-lisps-readability That article is dishonest. Speaking as the author, I'm a bit offended. Yes, the indentation width was changed, and this was acknowledged both

Re: Today's clojure trick question

2010-08-18 Thread Armando Blancas
I don't see what the concern may be. Can you elaborate? On Aug 18, 10:04 am, Matt Fowles matt.fow...@gmail.com wrote: All~ Boolean.valueOf() was added in 1.4.  While that seems ancient, some older libraries use 'new Boolean()' because they maintain 1.2 compatibility.  It seems like Clojure

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

2010-08-18 Thread Tim Daly
A more serious answer is that when I code in Java I use the brace-on-a-line kind of indentation. When I code in Lisp I never write single-line parens of any kind. I find that I think differently in each language. My Java code is always a pile of declare-this, do-this, do-this, return Thus I

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

2010-08-18 Thread Michael Gardner
On Aug 18, 2010, at 2:49 PM, Greg wrote: On Aug 18, 2010, at 12:07 PM, Michael Gardner wrote: On Aug 18, 2010, at 1:38 PM, Greg wrote: http://gregslepak.posterous.com/on-lisps-readability That article is dishonest. Speaking as the author, I'm a bit offended. Too bad. If you wanted

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

2010-08-18 Thread Greg
I should qualify my response though to say that I am not advocating that everyone switch their preferred style of code. Just simply giving reasons for why some prefer one style over another. It's a personal thing, and I do not wish to engage in a flame war over it. Best, Greg On Aug 18, 2010,

Re: cool compiler-project?

2010-08-18 Thread .Bill Smith
While I think Clojure is an impressive achievement, I would not have thought that the Clojure compiler (or Lisp compilers in general) would be interesting for a post-grad student to work on. After all, Lisps are known for their simple syntax and grammar, and Clojure compiles to Java byte codes,

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

2010-08-18 Thread Phil Hagelberg
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 functions in there that are like this). Again, that's

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

2010-08-18 Thread Joop Kiefte
Actually, to be honest the short C++ example with lisp bracket style I find a lot easier to read: I don't need to scan all the page to find what belongs where... 2010/8/18 Greg g...@kinostudios.com: Now the question you're asking is, why don't lispers write  (MyFactory somearg  ) which makes

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

2010-08-18 Thread Sean Corfield
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 functions in there that are like this). But the

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

2010-08-18 Thread Tim Daly
Greg wrote: Now the question you're asking is, why don't lispers write (MyFactory somearg ) which makes me cringe. That's not at all what's being suggested -- you'll find that both in the OP's code and in the link below, there are many locations where closing parenthesis are ended

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

2010-08-18 Thread Greg
Yes, I read the link. I'm going to hazard a guess that lisp is not your native language :-) I consider Lisp to be one of my favorite languages (if not my favorite), and I've been coding in it for several years. It's rather silly to assume something about someone's programming experience

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

2010-08-18 Thread Greg
Too bad. If you wanted to focus on the trailing-parens (which you clearly did in that article), you should have kept everything else the same between your examples. Perhaps I should, then I wouldn't have to respond to your emails. :-p As I've said multiple times now, now indentation width

Re: cool compiler-project?

2010-08-18 Thread Jules
so presumably the Clojure compiler does not include an optimizer. So write an optimizing Clojure compiler! Or do type inference for Clojure. Or partial evaluation. Or a compiler that targets LLVM. On Aug 18, 10:46 pm, .Bill Smith william.m.sm...@gmail.com wrote: While I think Clojure is an

Re: cool compiler-project?

2010-08-18 Thread Jules
Or a Clojure to Javascript compiler. So many interesting projects! On Aug 19, 12:36 am, Jules julesjac...@gmail.com wrote: so presumably the Clojure compiler does not include an optimizer. So write an optimizing Clojure compiler! Or do type inference for Clojure. Or partial evaluation. Or

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

2010-08-18 Thread Fogus
I wrote a post about this very thread. http://blog.fogus.me/2010/07/12/wadlers-law-extended-to-clojure/ :f -- 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: cool compiler-project?

2010-08-18 Thread Angel Java Lopez
Hi people! Related to Clojure to Javascript http://github.com/richhickey/clojure-contrib/tree/master/clojurescript/ Angel Java Lopez http://www.ajlopez.com http://twitter.com/ajlopez On Wed, Aug 18, 2010 at 7:37 PM, Jules julesjac...@gmail.com wrote: Or a Clojure to Javascript compiler. So

Re: cool compiler-project?

2010-08-18 Thread cej38
+1 for an optimizer -- 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: cool compiler-project?

2010-08-18 Thread Mark Derricutt
Or a native dalvik compiler! -- Pull me down under... On Thu, Aug 19, 2010 at 10:37 AM, Jules julesjac...@gmail.com wrote: Or a Clojure to Javascript compiler. So many interesting projects! -- You received this message because you are subscribed to the Google Groups Clojure group. To

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

2010-08-18 Thread wwmorgan
The Incanter example is confusing for the same reason that the Leiningen example from the blog post is confusing, and I don't think paren style matters at all. The functions have grown over time, they're now too big, and they need to be refactored into several smaller functions. The paren style is

Re: cool compiler-project?

2010-08-18 Thread Tim Daly
Write a compiler routine to detect tail recursion. It is my (limited) understanding that Java can perform tail recursion elimination but only under limited conditions. Is there a way to detect tail recursion in Clojure and dynamically rewrite the code to do real recursion rather than using

Re: Today's clojure trick question

2010-08-18 Thread joegallo
However, if you do (let [x (java.lang.Boolean/getBoolean false)] (if x :trouble :ok)) you're fine, which obviously isn't helpful in your situation. Boolean.getBoolean() is pretty evil, too. It was featured in one of Joshua Bloch's java puzzlers (which might have been borrowed from somewhere

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

2010-08-18 Thread Paul Stadig
I've rarely found these coding style discussions to be productive, and have wondered why source control systems don't just store code in a whitespace normalized format and automatically format the code to your own taste when you check it out, because, let's face it, formatting is semantically

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

2010-08-18 Thread Cyrus Harmon
I'm reminded gigamonkey's footnote about when functions get too big: A friend of mine was once interviewing an engineer for a programming job and asked him a typical interview question: how do you know when a function or method is too big? Well, said the candidate, I don't like any method to

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

2010-08-18 Thread Mike Meyer
On Wed, 18 Aug 2010 22:48:07 -0400 Paul Stadig p...@stadig.name wrote: Then I move on to thinking it best for a language designer to just legislate fomatting and make it a compiler error, but that would probably generate more discussion than otherwise, so I've just written the whole thing off

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

2010-08-18 Thread Greg
On Aug 18, 2010, at 7:48 PM, Paul Stadig wrote: It may help *you* grasp the meaning more quickly, but the opposite may be true for others. But I guess automatic formatting would totally destroy the ability to talk about line 16 of a particular file. This is a nifty point and idea. I think

Re: cool compiler-project?

2010-08-18 Thread Kevin Downey
only in the cases already handled by recur. jvm's goto instruction only works within method bodies On Wed, Aug 18, 2010 at 6:24 PM, Tim Daly d...@axiom-developer.org wrote: Write a compiler routine to detect tail recursion. It is my (limited) understanding that Java can perform tail

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

2010-08-18 Thread Rayne
It isn't helpful at all to me. My eyes bleed when I see code written like that. It may be helpful to some people, but I don't see the point when I have an editor that can match parens for me without any real work on my part. The parens aren't something I feel I need to maintain, because between

Re: cool compiler-project?

2010-08-18 Thread Tim Daly
Could the compiler insert phantom method bodies around classes? Or does the JVM insist that you can't lie about the code structure? Am I being too lispish for the JVM? Clearly the JVM needs to look up some factoid out of the method body in order to recur so I'm suggesting that the whole set of