Warning unboxing of primitives

2010-08-03 Thread Nicolas Oury
Dear all, I am writing a data structure that does a lot of arithmetic operations (+, - , bit-shifting, bit masking...) I did my best to use primitive types, but I am not sure it works everywhere. Is there a way of being warned of unboxings to primitives, with the RC1 of 1.2? (I think it might

Re: Why no tail call optimization

2010-08-03 Thread Michał Marczyk
On 3 August 2010 04:16, Dan Kersten dkers...@gmail.com wrote: Why can't the clojure bytecode compiler hand-perform this like functional languages do when compiling to native code? Because bytecode attempting to manipulate the stack and jump around (unrestricted goto-like) in other ways than

Re: Clojure Job Opportunity

2010-08-03 Thread fin
Can a person outside US apply? On Aug 3, 6:44 am, Jack_Kennedy - AVID jkennedy1...@gmail.com wrote: Looking for a Senior Software Engineer with experience working with Clojure to join a fantastic company in the Boston area. This person will be responsible for designing and developing next

Re: Records can't be treated as functions anymore

2010-08-03 Thread Baishampayan Ghose
Karl, It is a common mistake to think that callability, corresponding to the clojure.lang.IFn interface, is part of the persistent map contract (I've done it myself, as did many others a Conj labs :). It is not. It is actually just a feature of clojure.lang.PersistentHashMap (and the other

Re: Why no tail call optimization

2010-08-03 Thread Daniel Kersten
Can one not detect that a recursive call is a tail call and then transform the AST so that its iterative instead - ie, not use the stack besides for initial setup of local variables (which then get reused in each recursive tail-call). Isn't this how its done in native compiled languages with TCO?

Running on .Net

2010-08-03 Thread taotree
I have a 3rd party platform I am working to write add-ons for and so am restricted to .Net. I'd like to write in Clojure. ClojureCLR looked too intimidating to get it going and ikvmc was very easy for Java, so I thought I'd try it with Clojure. I ran ikvmc on clojure.jar and saw a number of

2 links for beginners

2010-08-03 Thread faenvie
as a beginner i found 2 links that i can recommend to others who want to step into matter: 1. mark volkmann's article about clojure: http://java.ociweb.com/mark/clojure/article.html this is a first class introduction to clojure and you can read through it in 2-3 days. it contains everything a

Re: Why no tail call optimization

2010-08-03 Thread Rich Hickey
On Aug 3, 2:19 am, Daniel Kersten dkers...@gmail.com wrote: Can one not detect that a recursive call is a tail call and then transform the AST so that its iterative instead - ie, not use the stack besides for initial setup of local variables (which then get reused in each recursive

Re: Why no tail call optimization

2010-08-03 Thread Peter Schuller
Interestingly, [Erjang][1] (a port of Erlang to the JVM) apparently performs TCO while claiming to stay reasonably fast. The gimmick I have never done extensive benchmarking of clojure, but given the frequent mentions of use of '-server' in order to achieve specific performance goals, I get the

Re: Running on .Net

2010-08-03 Thread Hadi Hariri
I've gotten ClojureCLR running on .NET. If you're interested in trying it, ping me and I'll help with what I can. I'm also interested to know if there's some kind of installer or package provided for it yet because as you say it does take a bit to setup. I'd be eager to help in that area if

Re: Clojure Job Opportunity

2010-08-03 Thread Jack_Kennedy - AVID
This position does offer a possible sponsership of a visa. However, the candidate applying would have to be a perfect fit. If interested please send a resume and a sample of some clojure code (blog or bitbucket) to jack.kenn...@avidtr.com. If our client thinks your skills are worth the expense of

Re: 2 links for beginners

2010-08-03 Thread Frederick Polgardy
That is the most unsubstantiated, moronic piece of writing I've ever read in my life. I can't really tell what he's attacking, he's just swinging some dick-shaped sword around trying to hit stuff. -Fred -- Science answers questions; philosophy questions answers. On Aug 3, 2010, at 6:30 AM,

Re: 2 links for beginners

2010-08-03 Thread nickikt
The artical is really good for people you like to jump in headfirst. I'm more of a book first guy but I told my, soon to be Clojure Programmer :) , friend about that article. Thats why nobody likes (liked) the Lisp compunity. Read the Comments http://www.loper-os.org/?p=42 On Aug 3, 4:05 pm,

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Moritz Ulrich
Defining function (with defn) inside another function isn't very beautiful (def* outside of the top-level is generally disregarded). It looks like you use thhelp only inside the thsolve-function. Use either letfn or (let [thhelp (fn )] ...) here. On Tue, Aug 3, 2010 at 5:07 AM, Mark Engelberg

small gotcha with the helpfile of empty? / seq?

2010-08-03 Thread bOR_
Occasionally, I want to map a collection of seqs to their is-empty or is-not-empty status (e.g. true / false). And the helpfile of empty? puts me on the wrong leg occasionally. clojure.core/ empty? ([coll]) Returns true if coll has no items - same as (not (seq coll)). Please use the idiom

Re: Running on .Net

2010-08-03 Thread eyeris
I really wish that ClojureCLR had a binary distribution. I like clojure a lot but I have a .Net background and a lot of .Net code to interact with. If ClojureCLR had a stable, dependable binary distribution I would be able to use it at work much more than I already do. I don't care much about 1.2

Re: Records can't be treated as functions anymore

2010-08-03 Thread Daniel Gagnon
Hi BG, It is a common mistake to think that callability, corresponding to the clojure.lang.IFn interface, is part of the persistent map contract (I've done it myself, as did many others a Conj labs :). It is not. It is actually just a feature of clojure.lang.PersistentHashMap (and the

Keywords as enumerations

2010-08-03 Thread vishy
Hi, In The Joy of Clojure book, it is mentioned Very often Clojure code will use keywords as enumerations: :small :medium :large. What does this mean? thanks -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Keywords as enumerations

2010-08-03 Thread Nicolas Oury
I think enumeration here refers to a given number of possible choices Here, it refers to a size, that can be one of the three (:small, :medium, :large). The choices are known in advance and in finite number. It is a traditional way of describing that, that is at least as old as C's enum. (I am

= and byte arrays

2010-08-03 Thread Steven Devijver
Given two byte arrays that have the same content (value) the code below runs without errors: (def ba1 (...)) (def ba2 (...)) (assert (not= ba1 ba2)) (assert (= (String. ba1) (String ba2))) Is this as expected? -- You received this message because you are subscribed to the Google Groups

Re: 2 links for beginners

2010-08-03 Thread Mike Meyer
On Tue, 3 Aug 2010 07:28:39 -0700 (PDT) nickikt nick...@gmail.com wrote: The artical is really good for people you like to jump in headfirst. I'm more of a book first guy but I told my, soon to be Clojure Programmer :) , friend about that article. Thats why nobody likes (liked) the Lisp

Re: Keywords as enumerations

2010-08-03 Thread Laurent PETIT
Should probably have been written as enumeration values (and not solely as enumerations). 2010/8/3 vishy vishalsod...@gmail.com Hi, In The Joy of Clojure book, it is mentioned Very often Clojure code will use keywords as enumerations: :small :medium :large. What does this mean? thanks

Re: = and byte arrays

2010-08-03 Thread Laurent PETIT
yes, since arrays are mutables, the only equality semantics that's stable over the application timeline is object identity equality. Thus = on arrays is based on java's == 2010/8/3 Steven Devijver steven.devij...@gmail.com Given two byte arrays that have the same content (value) the code below

Re: = and byte arrays

2010-08-03 Thread Randy Hudson
(= (seq ba1) (seq ba2)) will give you a value (byte-by-byte) comparison. On Aug 3, 2:00 pm, Steven Devijver steven.devij...@gmail.com wrote: Given two byte arrays that have the same content (value) the code below runs without errors: (def ba1 (...)) (def ba2 (...)) (assert (not= ba1 ba2))

Re: dtd question

2010-08-03 Thread Manfred Lotz
Hi Randy, On Sun, 1 Aug 2010 15:02:59 -0700 (PDT) Randy Hudson randy_hud...@mac.com wrote: I think we're almost there, sorry for the various mistakes. If you look in the source for clojure.xml, you can see that the default startparse argument for xml/parse is (defn startparse-sax [s ch]

equality of primitive values

2010-08-03 Thread Nicolas Oury
Dear all, I am still fighting with a profiler and primitive hints. It seems I cannot manage to have a direct equality check of the primitive. My profiler tells me it goes through clojure.lang.Numbers eq. What is the best way to test equality of unboxed primitive? (The two primitive are of the

Re: 2 links for beginners

2010-08-03 Thread Baishampayan Ghose
Fred, That is the most unsubstantiated, moronic piece of writing I've ever read in my life. I can't really tell what he's attacking, he's just swinging some dick-shaped sword around trying to hit stuff. It's OK, it's alright. Naysayers will always have some issue to pick on, and when they

What is #_

2010-08-03 Thread Yang Dong
Hi, I've read the src of core.clj of Clojure 1.1.0. Originally I thought the meaning of #_ is to comment the thing after it, sort of like `;'. But the in the src of core.clj in 1.2.0-RC1. The definition of reduce is overrided to use the internal-reduce function. The defn line, is preceded by

Re: Running on .Net

2010-08-03 Thread Hadi Hariri
For the binary distribution, it's not hard. I could setup a CI project at http://teamcity.codebetter.com and put together some binaries to download. Regarding Stability and speed, it's way too early for me to comment since I'm a newbie with Clojure so I couldn't really comment. On 3 August 2010

Re: Running on .Net

2010-08-03 Thread Timothy Baldridge
I really wish that ClojureCLR had a binary distribution. I like clojure a lot but I have a .Net background and a lot of .Net code to interact with. If ClojureCLR had a stable, dependable binary distribution I would be able to use it at work much more than I already do. I don't care much about

Resource cleanup when lazy sequences are finalized

2010-08-03 Thread David Andrews
I want to create a lazy seq backed by an open file (or db connection, or something else that needs cleanup). I can't wrap the consumer in a with-anything. Is there a general method for cleaning up after the consumer discards its reference to that lazy seq? I'm vaguely aware of Java finalize,

Re: What is #_

2010-08-03 Thread Meikel Brandmeyer
Hi, Am 03.08.2010 um 16:45 schrieb Yang Dong: I've read the src of core.clj of Clojure 1.1.0. Originally I thought the meaning of #_ is to comment the thing after it, sort of like `;'. But the in the src of core.clj in 1.2.0-RC1. The definition of reduce is overrided to use the

Re: What is #_

2010-08-03 Thread Nikita Beloglazov
#_ comments the whole form, starting with parent just after #_ : #_(bla-bla (bla-bla2 ... ) ) for example (+ #_ (+ 2 3 4 (* 1 2) ) 1 2) Will return 3, because form with (+ 2 3 ... ) will be ignored by reader So it's restricted by 1 line like ; Regards Nikita Beloglazov On

Re: What is #_

2010-08-03 Thread Nikita Beloglazov
Sorry, it's NOT restricted by 1 line, like ; :) Regards Nikita Beloglazov On Tue, Aug 3, 2010 at 10:54 PM, Nikita Beloglazov nikelandj...@gmail.comwrote: #_ comments the whole form, starting with parent just after #_ : #_(bla-bla (bla-bla2 ... ) ) for example (+ #_ (+ 2 3 4 (*

Re: Running on .Net

2010-08-03 Thread dmiller
I can move creating a binary distribution to the to top of the list. I could use some guidance from the interested on what would serve the purpose on this and other things mentioned here. on the distribution: Do you want just a zip of of DLLs? An installer? Do you want installation to the

Re: Resource cleanup when lazy sequences are finalized

2010-08-03 Thread Brian Hurt
On Tue, Aug 3, 2010 at 3:21 PM, David Andrews dammi...@gmail.com wrote: I want to create a lazy seq backed by an open file (or db connection, or something else that needs cleanup). I can't wrap the consumer in a with-anything. Is there a general method for cleaning up after the consumer

Re: Resource cleanup when lazy sequences are finalized

2010-08-03 Thread David Andrews
On Aug 3, 4:40 pm, Brian Hurt bhur...@gmail.com wrote: So the real answer is: this isn't a good use for seqs. I was afraid that was the case. Too bad, 'cause seqs are otherwise elegant. Thanks for the sanity check. -- You received this message because you are subscribed to the Google Groups

Re: Symbol substitution in macro

2010-08-03 Thread Kyle Schaffrick
On Mon, 2 Aug 2010 07:23:12 -0400 Andrew Boekhoff boekho...@gmail.com wrote: On Sunday 01 August 2010 21:34:16 Kyle Schaffrick wrote: Hello, I'm trying to write a library with two main parts. The first is a macro, I'll call it 'with-feature, that walks through forms passed inside it,

Re: Why no tail call optimization

2010-08-03 Thread Dale
When speaking about general TCO, we are not just talking about recursive self-calls, but also tail calls to other functions. Full TCO in the latter case is not possible on the JVM at present whilst preserving Java calling conventions (i.e without interpreting or inserting a trampoline etc).

Time and FRP

2010-08-03 Thread Andreas S.
Hello! I have bit vague question is ( and if how..) Clojure model of value/ state/identity related to the problem described here: http://pchiusano.blogspot.com/2010/07/reification-of-time-in-frp-is.html ? thanks, regards andreas -- You received this message because you are subscribed to the

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Dale
On Aug 2, 11:07 pm, Mark Engelberg mark.engelb...@gmail.com wrote: Can you distill this down to the smallest possible example that demonstrates the error? Nope. Just spent some time trying to duplicate the nested function bug in a simpler context. A pointer to the place where I should deposit

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Dale
On Aug 3, 11:26 am, Moritz Ulrich ulrich.mor...@googlemail.com wrote: Defining function (with defn) inside another function isn't very beautiful (def* outside of the top-level is generally disregarded). It looks like you use thhelp only inside the thsolve-function. Use either letfn or (let

Re: Running on .Net

2010-08-03 Thread Timothy Baldridge
Personally I'd like to see it in a .zip of assemblies. GAC can make it a bit hard to copy around...90% of my 3rd party assemblies, I just throw in a folder and reference in VC# where they get copied into the build directory. Unfortunately, I haven't gotten ClojureCLR to compile, so I can't speak

Re: Resource cleanup when lazy sequences are finalized

2010-08-03 Thread Jeff Palmucci
See my library at http://github.com/jpalmucci/clj-yield, which makes this trivial. For example, here is a function I use to read a sequence of java serialized objects from a stream: (defn read-objects [path] (with-yielding [out 1000] (with-open [stream (java.io.ObjectInputStream.

Re: Why no tail call optimization

2010-08-03 Thread Daniel Kersten
Thanks for the replies, that certainly clarified things! On 3 August 2010 13:39, Rich Hickey richhic...@gmail.com wrote: On Aug 3, 2:19 am, Daniel Kersten dkers...@gmail.com wrote: Can one not detect that a recursive call is a tail call and then transform the AST so that its iterative

Re: What is #_

2010-08-03 Thread Yang Dong
Thank you! I have just another question not related about this topic: ;during bootstrap we don't have destructuring let, loop or fn, will redefine later (def ^{:macro true :added 1.0} let (fn* let [form env decl] (cons 'let* decl))) In Clojure 1.2.0, the preceding definition of let taks

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Mark Engelberg
On Tue, Aug 3, 2010 at 1:06 PM, Dale dpar...@ptd.net wrote: This statement is ironic, considering the definition of a functional closure, after which Clojure is presumably named. You're missing the point. A defn inside another defn doesn't do what you think it does. defn always creates a

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Mark Engelberg
On Tue, Aug 3, 2010 at 1:00 PM, Dale dpar...@ptd.net wrote: On Aug 2, 11:07 pm, Mark Engelberg mark.engelb...@gmail.com wrote: Can you distill this down to the smallest possible example that demonstrates the error? Nope. Just spent some time trying to duplicate the nested function bug in

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Mark Engelberg
Similarly, don't use def inside of a defn. Use let. On Tue, Aug 3, 2010 at 9:10 PM, Mark Engelberg mark.engelb...@gmail.comwrote: On Tue, Aug 3, 2010 at 1:06 PM, Dale dpar...@ptd.net wrote: This statement is ironic, considering the definition of a functional closure, after which Clojure is

Re: Why no tail call optimization

2010-08-03 Thread Mark Engelberg
Some people even prefer 'recur' to the redundant restatement of the function name. In addition, recur can enforce tail-call position. Rich Because recur only takes you back to the innermost loop, sometimes I miss the ability to jump back to some outer loop (or the overall function call).

Re: Running on .Net

2010-08-03 Thread eyeris
I would like a zip of DLLs that are as widely compatible as possible across CLR/DLR versions accompanied by a clear list of which versions are compatible. Regarding releases, I'm glad to lag behind the bleeding edge by a lot in order to have a stable platform. What I want to be able to do is grab

Keywords also have a literal syntax

2010-08-03 Thread vishy
What does it mean? Does it mean that :hello itself is a value,so we call it literal syntax.Also, this form of vector [1 2 3] is also literal syntax. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Keywords also have a literal syntax

2010-08-03 Thread Daniel Gagnon
On Wed, Aug 4, 2010 at 1:33 AM, vishy vishalsod...@gmail.com wrote: What does it mean? Does it mean that :hello itself is a value,so we call it literal syntax.Also, this form of vector [1 2 3] is also literal syntax. A vector evaluates all of its arguments. If I write [1 2 (+ 1 2)], I'll

Re: What is #_

2010-08-03 Thread Meikel Brandmeyer
Hi, On Aug 4, 2:32 am, Yang Dong ydong.pub...@gmail.com wrote: Thank you! I have just another question not related about this topic: ;during bootstrap we don't have destructuring let, loop or fn, will redefine later (def   ^{:macro true     :added 1.0}   let (fn* let [form env decl]