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 be better to warn on unboxing than on boxing, but I
am not sure and I would be happy with any.
Here is the rational : most of the time boxing happens for a reason
(call to something or storage in a data structure, for example)
, but unboxing happens when you wanted primitive and did not managed
to keep things primitive)

Best regards,

Nicolas.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 through the usual JVM
method call mechanisms would not pass verification (the first step of
the bytecode loading process on the JVM).

 Is it to keep
 the clojure compiler fast (for dynamic runtime compilation), since
 performing tail call optimisation presumably requires a bunch of extra
 checks and more complex code generation? Perhaps this could be done on
 AOT compilation?

TCO adds no complexity at all when the generated object code handles
its own stack, subroutine calling conventions etc. A compiler
targeting native code has the option of simply not storing a new
return address on the stack when compiling a tail call (if the
arguments to the current subrouting where passed in registers; if they
were passed in a stack frame, it can simply be popped, with the return
address saved and reused for the tail call). On the JVM it is
impossible, because the generated object code (JVM bytecode) is not
permitted to do this sort of thing.

Interestingly, [Erjang][1] (a port of Erlang to the JVM) apparently
performs TCO while claiming to stay reasonably fast. The gimmick
involved is apparently a particularly smart implementation of
trampolining. Read more about it [here][2]. I have a hunch that this
is a no-go for Clojure (partly because Clojure tends to insist on
staying close to the platform -- which has significant benefits -- and
partly because I'm not sure if this kind of thing wouldn't disagree
with Clojure's extremely dynamic nature... I haven't thought this
through that well, though, so maybe this is nonsense). At any rate, it
is interesting.

Sincerely,
Michał


[1] git://github.com/krestenkrab/erjang
[2] http://wiki.github.com/krestenkrab/erjang/how-erjang-compiles-tail-recursion

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 generation
 software for the purpose of delivering mobile content running on a
 large network of servers.

 If interested please call me at 617-951-1891.

 Relocation is offered for this position.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 clojure map implementations).

 I haven't looked at the compiler, but I think that defrecord creates a
 class that implements clojure.lang.IPersistentMap (among others).

 Note, Christophe pointed out to me: this is also relevant when you are
 extending a protocol to clojure.lang.IPersistentMap: don't rely on
 callability when accessing the map (this was the mistake I made).

Makes sense. Thanks, Karl.

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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?
How is this different from generating bytecode for iterative loops in
imperative languages, or from what recur does? Alternatively, why can't the
tail call be detected and converted into recur? I'm guessing that the
problem is detecting tal calls - but why; speed of dynamic compilation?
Something else?

Obviously I'm missing something fundamental here - can somebody explain to
me what it is?

Thanks!

On 3 August 2010 05:54, Wilson MacGyver wmacgy...@gmail.com wrote:

 as Rich Hickey stated

 question: Is it fundamentally impossible to do TCO on JVM due to
 current JVM lack of primitives to do so? Would TCO ever be possible on
 the JVM without a new JVM design?
 rhickey: TCO is easy if you are an interpreter - see SISC Scheme.
 Using Java's call stack, the JVM would have to provide it. There are
 no fundamental technical difficulties, but potential issues for the
 security model, which uses the call stack to ensure privileges.

 On Mon, Aug 2, 2010 at 10:16 PM, 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? Is it to keep
  the clojure compiler fast (for dynamic runtime compilation), since
  performing tail call optimisation presumably requires a bunch of extra
  checks and more complex code generation? Perhaps this could be done on
  AOT compilation?
 
  On Aug 3, 2:58 am, Frederick Polgardy f...@polgardy.com wrote:
  It means that the JVM doesn't look at method calls and figure out that
 they're in tail call position and optimize them. You can hand-write code
 that performs a goto in a tight loop (like recur does), but means you can't
 assume that method calls in general will be tail call optimized.
 
  -Fred
 
  --
  Science answers questions; philosophy questions answers.
 
  On Aug 2, 2010, at 4:09 PM, Dale wrote:
 
   The JVM has an unconditional goto opcode and the ability to re-bind
   function parameters, so why no tail-call optimization? Thanks.
 
   Dale
 
   --
   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, send email to
   clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
 
  --
  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, send email to
  clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en



 --
 Omnem crede diem tibi diluxisse supremum.

 --
 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, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




-- 
Daniel Kersten.
Leveraging dynamic paradigms since the synergies of 1985.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 errors (or something),
but ignored them, and it did create clojure.dll. I ran ikvmc on my
own .class files that were generated by the compile macro.

Trying to call a method on my class (with clojure.dll referenced)
resulted in:

Unhandled Exception: System.TypeInitializationException: The type
initializer fo
r 'test.clojure.MyClass' threw an exception. ---
System.TypeInitializationExcep
tion: The type initializer for 'clojure.lang.RT' threw an exception.
--- java.l
ang.RuntimeException: java.io.FileNotFoundException: Could not locate
clojure/co
re__init.class or clojure/core.clj on classpath:
   --- End of inner exception stack trace ---
   at clojure.lang.Namespace..ctor(Symbol )
   at clojure.lang.Namespace.findOrCreate(Symbol name)
   at clojure.lang.Var.internPrivate(String nsName, String sym)
   at test.clojure.MyClass..cctor()
   --- End of inner exception stack trace ---
   at test.clojure.MyClass.main(String[] strarr)
   at StartupCode$FSTestApp.$Mentics.Series.App.main@() in C:\Users
\jshellman\
Documents\Visual Studio 2008\Projects\FSTestForNT\FSTestApp
\Mentics.Series.App.f
s:line 14

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 typical beginner need to know and i think that in
some respects marks article is even better organized
than 'programming  clojure' or 'the joy of clojure' --
both are excellent books though and can be
recommended for reading after marks article.

2. an article to read after 1. IMO that is useful as an antitoxin
for beginners:

http://imagine27.com/articles/2009-08-19-011225_clojure_the_false_lisp.html

because excitement is always a bad thing ...
isn't it ?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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
 tail-call). Isn't this how its done in native compiled languages with TCO?
 How is this different from generating bytecode for iterative loops in
 imperative languages, or from what recur does? Alternatively, why can't the
 tail call be detected and converted into recur? I'm guessing that the
 problem is detecting tal calls - but why; speed of dynamic compilation?
 Something else?

 Obviously I'm missing something fundamental here - can somebody explain to
 me what it is?


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).

While making self tail-calls into jumps would be easy (after all,
that's what recur does), doing so implicitly would create the wrong
expectations for those coming from, e.g. Scheme, which has full TCO.
So, instead we have an explicit recur construct.

Essentially it boils down to the difference between a mere
optimization and a semantic promise. Until I can make it a promise,
I'd rather not have partial TCO.

Some people even prefer 'recur' to the redundant restatement of the
function name. In addition, recur can enforce tail-call position.

Rich

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 impression clojure (i.e. Rich) definitely
wants to take advantage of all the optimizations the JIT can offer now
and in the future. Trampoline-based TCO would, as far as I can tell,
always defeat the JIT's notion of a call site - unless the JIT is made
to understand the trampoline (but then are we getting close to full
TCO support anyway? I dunno, I'm definitely not an expert on this
topic...). So, I would expect that those cases which are aggressively
optimized by JIT:ing, such as eliminating method lookups by inline
caching in light loops, would suffer potentially very extreme
performance impacts which aren't fixed by just avoiding allocation as
is mentioned in the erjang wiki page. Or is this over-stating the
problem?

-- 
/ Peter Schuller

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 there's interest.


On 3 August 2010 09:16, taotree jshell...@gmail.com wrote:
 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 errors (or something),
 but ignored them, and it did create clojure.dll. I ran ikvmc on my
 own .class files that were generated by the compile macro.

 Trying to call a method on my class (with clojure.dll referenced)
 resulted in:

 Unhandled Exception: System.TypeInitializationException: The type
 initializer fo
 r 'test.clojure.MyClass' threw an exception. ---
 System.TypeInitializationExcep
 tion: The type initializer for 'clojure.lang.RT' threw an exception.
 --- java.l
 ang.RuntimeException: java.io.FileNotFoundException: Could not locate
 clojure/co
 re__init.class or clojure/core.clj on classpath:
   --- End of inner exception stack trace ---
   at clojure.lang.Namespace..ctor(Symbol )
   at clojure.lang.Namespace.findOrCreate(Symbol name)
   at clojure.lang.Var.internPrivate(String nsName, String sym)
   at test.clojure.MyClass..cctor()
   --- End of inner exception stack trace ---
   at test.clojure.MyClass.main(String[] strarr)
   at StartupCode$FSTestApp.$Mentics.Series.App.main@() in C:\Users
 \jshellman\
 Documents\Visual Studio 2008\Projects\FSTestForNT\FSTestApp
 \Mentics.Series.App.f
 s:line 14

 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 sponsership it will not be an issue.
Thanks!

On Aug 3, 12:04 am, fin gpl...@gmail.com wrote:
 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 generation
  software for the purpose of delivering mobile content running on a
  large network of servers.

  If interested please call me at 617-951-1891.

  Relocation is offered for this position.- Hide quoted text -

 - Show quoted text -

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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, faenvie wrote:

 2. an article to read after 1. IMO that is useful as an antitoxin
 for beginners:
 
 http://imagine27.com/articles/2009-08-19-011225_clojure_the_false_lisp.html
 
 because excitement is always a bad thing ...
 isn't it ?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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, Frederick Polgardy f...@polgardy.com wrote:
 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, faenvie wrote:

  2. an article to read after 1. IMO that is useful as an antitoxin
  for beginners:

 http://imagine27.com/articles/2009-08-19-011225_clojure_the_false_lis...

  because excitement is always a bad thing ...
  isn't it ?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 mark.engelb...@gmail.com wrote:
 Can you distill this down to the smallest possible example that demonstrates
 the error?

 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 (seq x) rather than (not (empty? x))

If I decide I specifically want true or false returned, and not
(content of seq) / false, I sometimes pick up seq?, not realizing that
it will always return true on both empty and filled seqs.

Made the mistake a few times so far, and I blame it on this helpfile
putting me on the wrong leg :-). Perhaps we could add a short line
after the last saying

, unless you specifically need true/false returned, rather than
content/false.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 features like defrecord. What
I care about is start-up speed, ease of embeddability, and Visual
Studio integration (not Intellisense, just AOT'ing .clj files).



On Aug 3, 7:30 am, Hadi Hariri hadihar...@gmail.com wrote:
 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 there's interest.

 On 3 August 2010 09:16, taotree jshell...@gmail.com wrote:

  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 errors (or something),
  but ignored them, and it did create clojure.dll. I ran ikvmc on my
  own .class files that were generated by the compile macro.

  Trying to call a method on my class (with clojure.dll referenced)
  resulted in:

  Unhandled Exception: System.TypeInitializationException: The type
  initializer fo
  r 'test.clojure.MyClass' threw an exception. ---
  System.TypeInitializationExcep
  tion: The type initializer for 'clojure.lang.RT' threw an exception.
  --- java.l
  ang.RuntimeException: java.io.FileNotFoundException: Could not locate
  clojure/co
  re__init.class or clojure/core.clj on classpath:
    --- End of inner exception stack trace ---
    at clojure.lang.Namespace..ctor(Symbol )
    at clojure.lang.Namespace.findOrCreate(Symbol name)
    at clojure.lang.Var.internPrivate(String nsName, String sym)
    at test.clojure.MyClass..cctor()
    --- End of inner exception stack trace ---
    at test.clojure.MyClass.main(String[] strarr)
    at StartupCode$FSTestApp.$Mentics.Series.App.main@() in C:\Users
  \jshellman\
  Documents\Visual Studio 2008\Projects\FSTestForNT\FSTestApp
  \Mentics.Series.App.f
  s:line 14

  --
  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, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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
 other clojure map implementations).


While I get that part, I wonder why records do not implement IFn, it'd be
convenient if they did.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 not old enough to track the notion further)

On Tue, Aug 3, 2010 at 6:37 PM, vishy vishalsod...@gmail.com wrote:
 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 clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


= 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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 compunity.
 Read the Comments http://www.loper-os.org/?p=42

Even LISPers:

http://steve-yegge.blogspot.com/2006/04/lisp-is-not-acceptable-lisp.html

mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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

 --
 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, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 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 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, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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))
 (assert (= (String. ba1) (String ba2)))

 Is this as expected?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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]
   (.. SAXParserFactory (newInstance) (newSAXParser) (parse s ch)))
 
 and we've only gotten as far as the newSAXParser part with the
 definition of parser. So:
 
 (defn startparse [s ch] (.parse parser s ch))
 (defn parse-xml [source]  (xml/parse source startparse))
 

Indeed now it compiles. I also played with startparse but my mistake
was to omit the dot in front of parse.


For some reasons I do not get it to ignore the DTD but it seems (from
Google search) that others had that issue before with EntityResolver.
It looks like resolver gets ignored.



But I found this Java snippet: 
SAXParser parser = factory.newSAXParser();
parser.setFeature(http://apache.org/xml/features/nonvalidating/load-external-dtd;,
false); 


This is the code that works now:
(ns xmltest
  (:require [clojure.zip :as zip]
[clojure.xml :as xml])
  (:use clojure.contrib.zip-filter.xml))


(import
  '[javax.xml.parsers SAXParserFactory])

(def parser 
  (let [pf (SAXParserFactory/newInstance)]
(do (. pf setFeature
http://apache.org/xml/features/nonvalidating/load-external-dtd; false)
(.newSAXParser pf


(defn startparse [s ch] (.parse parser s ch))

(defn parse-xml [source]  (xml/parse source startparse))

(parse-xml (java.io.File. test.xml))




Thanks a lot for your help.


-- 
Manfred


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 same primitive type)

Best regards,

Nicolas.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 don't have any (as in this case), they will resort
to such meaningless rants.

Let's set an example by completely ignoring such unhelpful yet poisonous people.

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 `#_'. But in 1.1.0, it's not preceded by this reader
macro. So, I'm confused...

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 18:56, eyeris drewpvo...@gmail.com wrote:
 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 features like defrecord. What
 I care about is start-up speed, ease of embeddability, and Visual
 Studio integration (not Intellisense, just AOT'ing .clj files).



 On Aug 3, 7:30 am, Hadi Hariri hadihar...@gmail.com wrote:
 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 there's interest.

 On 3 August 2010 09:16, taotree jshell...@gmail.com wrote:

  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 errors (or something),
  but ignored them, and it did create clojure.dll. I ran ikvmc on my
  own .class files that were generated by the compile macro.

  Trying to call a method on my class (with clojure.dll referenced)
  resulted in:

  Unhandled Exception: System.TypeInitializationException: The type
  initializer fo
  r 'test.clojure.MyClass' threw an exception. ---
  System.TypeInitializationExcep
  tion: The type initializer for 'clojure.lang.RT' threw an exception.
  --- java.l
  ang.RuntimeException: java.io.FileNotFoundException: Could not locate
  clojure/co
  re__init.class or clojure/core.clj on classpath:
    --- End of inner exception stack trace ---
    at clojure.lang.Namespace..ctor(Symbol )
    at clojure.lang.Namespace.findOrCreate(Symbol name)
    at clojure.lang.Var.internPrivate(String nsName, String sym)
    at test.clojure.MyClass..cctor()
    --- End of inner exception stack trace ---
    at test.clojure.MyClass.main(String[] strarr)
    at StartupCode$FSTestApp.$Mentics.Series.App.main@() in C:\Users
  \jshellman\
  Documents\Visual Studio 2008\Projects\FSTestForNT\FSTestApp
  \Mentics.Series.App.f
  s:line 14

  --
  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, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 1.2 features like defrecord. What
 I care about is start-up speed, ease of embeddability, and Visual
 Studio integration (not Intellisense, just AOT'ing .clj files).

 +1 for all of that

That paragraph basically explains why I haven't started using clojure
at my work yet.

Timothy Baldridge

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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,
but am also aware that it is unpredictable (e.g. you aren't guaranteed
to be driven at the next gc).

Does Clojure even provide the ability to define a finalize method for
a lazy seq?

(Sipping water from a firehose...)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 internal-reduce function. The defn line, is
 preceded by `#_'. But in 1.1.0, it's not preceded by this reader
 macro. So, I'm confused...

You are absolutely right. The #_ is kind of comment. And in fact the override 
with the internal reduce function is commented out (ie. it’s not active) in 1.2.

Sincerely
Meikel

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 Tue, Aug 3, 2010 at 10:35 PM, Meikel Brandmeyer m...@kotka.de wrote:

 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 internal-reduce function. The defn line, is
  preceded by `#_'. But in 1.1.0, it's not preceded by this reader
  macro. So, I'm confused...

 You are absolutely right. The #_ is kind of comment. And in fact the
 override with the internal reduce function is commented out (ie. it’s not
 active) in 1.2.

 Sincerely
 Meikel

 --
 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, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 (* 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 Tue, Aug 3, 2010 at 10:35 PM, Meikel Brandmeyer m...@kotka.de wrote:

 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 internal-reduce function. The defn line, is
  preceded by `#_'. But in 1.1.0, it's not preceded by this reader
  macro. So, I'm confused...

 You are absolutely right. The #_ is kind of comment. And in fact the
 override with the internal reduce function is commented out (ie. it’s not
 active) in 1.2.

 Sincerely
 Meikel

 --
 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, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 GAC?

on 'stable, dependable': Is there any strategy on creating new
releases that makes sense?  Assume anyone wanting to stay on the
bleeding edge will build for themselves?

start-up speed:  I'm running some experiments on that.   The problem
is mostly the monolithic nature of the assemblies created and the
amount of environment initialization.  Suggestions welcomed.

Ease of embeddability: please elaborate on the problems.

AOT'ing clj files:  Ditto.

-David

On Aug 3, 12:47 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
  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 features like defrecord. What
  I care about is start-up speed, ease of embeddability, and Visual
  Studio integration (not Intellisense, just AOT'ing .clj files).

  +1 for all of that

 That paragraph basically explains why I haven't started using clojure
 at my work yet.

 Timothy Baldridge

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 discards
 its reference to that lazy seq?  I'm vaguely aware of Java finalize,
 but am also aware that it is unpredictable (e.g. you aren't guaranteed
 to be driven at the next gc).

 Does Clojure even provide the ability to define a finalize method for
 a lazy seq?

 (Sipping water from a firehose...)


The descriptor(/db connection/etc) will be cleaned up eventually, when the
finalizer runs.  The problem with this is that you don't know when the
finalizer will run, and it can be arbitrarily delayed.  So it's possible for
a program to run out of file descriptors, if there are file descriptors
which are garbage but not yet collected.

Another possibility, if you know that the consumer will force the entire
list before discarding it, is to concat on a zero-element list which closes
the descriptor, like:

(concat orig-list
(lazy-seq (do (.close fd) [])))

On the other hand, the consumer doesn't force the whole list, then the
descriptor never gets closed.

So the real answer is: this isn't a good use for seqs.  It looks like one,
but it isn't.

Brian

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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, and any time it sees a call to another function in my
  library, 'feature, do some transformations.
  
  The problem I'm concerned about is as follows: When my macro sees
  the forms that are passed into it, the symbols come in however the
  consumer of the library wrote them. So say I :require my library and
  alias it to 'mylib', then the call 'with-feature is looking for
  appears as 'mylib/feature. Or, I could :use the library, and then it
  would appear as 'feature, or I could alias 'feature to 'banana--you
  get the idea.
  
  I don't want to reserve some magic symbol name that defies namespace
  rules, so that if the library consumer code uses the symbol 'feature
  to mean something different, they get bizarre results.
  
  What is a good pattern for writing the matching logic in such a
  selectively-transforming macro so that it can properly find the
  magic call it's looking for in the presence of normal namespacing
  behavior?
  
  Thanks,
  
  -Kyle
 
 
 Hi,
   The following technique seems to work for finding out if you've
 been aliased:
 
 (ns somewhere.trial)
 
 (let [here *ns*]
   (defmacro whats-my-name []
  (some (fn [[k v]] (when (= here v) `(quote ~k)))
 (ns-aliases *ns*
 
 user (require '[somewhere.trial :as aliased]) = 
 user (aliased/whats-my-name) = aliased
 
 So at the top of with-feature the parser could check for an alias and
 construct the appropriate predicate from the result.
 
 -Andy
 

I originally had something similar to this actually, but it doesn't work
for the case when the library is referred in the consumer code with :use
because the symbol's namespace is then nil, and you still can't tell if
they're shadowing it with a let binding, or have renamed it with :as.

However, this idea occurred to me yesterday. What if I check to see if
the symbol is pointing to the *var* containing my magic function,
instead of trying to examine the symbol itself? e.g.:

  (= (resolve symbol-i-am-scanning-in-my-macro)
 #'function-i-am-looking-for)

It seems to work, since at macro-expand time *ns* is bound to the
consumer code's namespace. Does this seem like a reasonable way to deal
with this?

-Kyle

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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).

Understood. Thanks!

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 code that manifests a
run-time bug in Clojure would be the thing here. Code that reliably
exposes underlying bugs is like money in the bank.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 [thhelp (fn )] ...) here.

This statement is ironic, considering the definition of a functional
closure, after which Clojure is presumably named.

From http://en.wikipedia.org/wiki/Closure_%28computer_science%29

In some languages, a closure may occur when a function is defined
within another function, and the inner function refers to local
variables of the outer function. At runtime, when the outer function
executes, a closure is formed, consisting of the inner function’s code
and references to any variables of the outer function required by the
closure; such variables are called the upvalues of the closure.

I haven't had an application for returning closures as first class
objects (yet), but presumably, if Clojure supports first-class
functions (see http://clojure.org/functional_programming) and allows
nested function definitions with lexical scope, then it supports
closures.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 to the startup times. For the most part, a 1-2 sec startup isn't
bad in my book though.


Timothy

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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.
   (java.io.BufferedInputStream.
(java.util.zip.GZIPInputStream.
 (java.io.FileInputStream. (io/file path)]
 (loop []
   (try
(let [next (.readObject stream)]
  (yield out next)
  (recur))
(catch java.io.EOFException e (.close stream)))

When the sequence returned by with-yielding becomes garbage
collectable, yield will throw an exception causing with-open to close
the file.

Note that with-yielding will use a thread from the thread pool, so its
a bad idea to have hundreds of active with-yieldings at once.

On Aug 3, 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 discards
 its reference to that lazy seq?  I'm vaguely aware of Java finalize,
 but am also aware that it is unpredictable (e.g. you aren't guaranteed
 to be driven at the next gc).

 Does Clojure even provide the ability to define a finalize method for
 a lazy seq?

 (Sipping water from a firehose...)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 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?
  How is this different from generating bytecode for iterative loops in
  imperative languages, or from what recur does? Alternatively, why can't
 the
  tail call be detected and converted into recur? I'm guessing that the
  problem is detecting tal calls - but why; speed of dynamic compilation?
  Something else?
 
  Obviously I'm missing something fundamental here - can somebody explain
 to
  me what it is?
 

 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).


Ah, this where my confusion was then.
Self-calls aren't the problem at all, since they can be compiled how recur
is, but tail-calls to other functions cannot be due to the JVM's calling
conventions. I understand now, thanks for the explanation.



 While making self tail-calls into jumps would be easy (after all,
 that's what recur does), doing so implicitly would create the wrong
 expectations for those coming from, e.g. Scheme, which has full TCO.
 So, instead we have an explicit recur construct.


 Essentially it boils down to the difference between a mere
 optimization and a semantic promise. Until I can make it a promise, I'd
 rather not have partial TCO.


To me, it is really only an optimization and I'm very much in the group who
likes the explicit recur statement, since it conveys intent. Therefore I'd
be happy with the partial optimization, though, honestly, not having it
doesn't bother me at all.


 Some people even prefer 'recur' to the redundant restatement of the
 function name. In addition, recur can enforce tail-call position.

 Rich

 --
 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, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




-- 
Daniel Kersten.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 the strange
argument of `form' and `env'. What are they?

On Aug 4, 3:35 am, Meikel Brandmeyer m...@kotka.de wrote:
 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 internal-reduce function. The defn line, is
  preceded by `#_'. But in 1.1.0, it's not preceded by this reader
  macro. So, I'm confused...

 You are absolutely right. The #_ is kind of comment. And in fact the override 
 with the internal reduce function is commented out (ie. it’s not active) in 
 1.2.

 Sincerely
 Meikel

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 global variable, even when it looks
like it should create a local.  You can create closures, but you should use
letfn instead.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 a simpler context.


Well if you can't duplicate the bug in a simpler context, it seems more
likely that the bug is in the logic of your code, or your understanding of
these constructs, doesn't it?

Your example is long enough I only had time to glance briefly at it.  Based
on what I could glean from that quick look, I think you may have a
misunderstanding about how with-local-vars works. vars are thread-specific,
and they have a lifetime that is delimted by dynamic scoping rather than
lexical scoping.  Using vars in conjunction with futures seems like a recipe
for disaster.  A null pointer exception would be not at all surprising to me
in this context, because the var goes away when the block of code that
created it exits.

I generally advise people to stay away from vars unless they know exactly
what they are doing.  Vars have all sorts of unintuitive interactions with
laziness and multithreading.

Try refactoring your algorithm in a way that doesn't need mutable locals.
If you absolutely do need a mutable local, just use an atom.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 presumably named.


 You're missing the point.  A defn inside another defn doesn't do what you
 think it does.  defn always creates a global variable, even when it looks
 like it should create a local.  You can create closures, but you should use
 letfn instead.


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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).
Hypothetically, could Clojure support a way to name a specific loop, and use
a version of recur that lets you jump back to a given named outer loop (like
Scheme's named let), or is this outside the scope of what Java's goto
permits?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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 the DLLs, add them as references to my VS project, and compile,
much like I do with NetBeans and the JVM clojure.

I have to admit that I haven't tried ClojureCLR since right around the
1.1 release, so I don't remember the details of the problems that I
encountered. I am in the process of migrating a lot of stuff from VS
2008 to VS 2010. Once I finish that I will try ClojureCLR again and
get back to you regarding embedding and AOT.



On Aug 3, 3:11 pm, dmiller dmiller2...@gmail.com wrote:
 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 GAC?

 on 'stable, dependable': Is there any strategy on creating new
 releases that makes sense?  Assume anyone wanting to stay on the
 bleeding edge will build for themselves?

 start-up speed:  I'm running some experiments on that.   The problem
 is mostly the monolithic nature of the assemblies created and the
 amount of environment initialization.  Suggestions welcomed.

 Ease of embeddability: please elaborate on the problems.

 AOT'ing clj files:  Ditto.

 -David

 On Aug 3, 12:47 pm, Timothy Baldridge tbaldri...@gmail.com wrote:

   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 features like defrecord. What
   I care about is start-up speed, ease of embeddability, and Visual
   Studio integration (not Intellisense, just AOT'ing .clj files).

   +1 for all of that

  That paragraph basically explains why I haven't started using clojure
  at my work yet.

  Timothy Baldridge

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


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 get
the same vector you got with [1 2 3]. Keywords always evaluate to
themselves.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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] (cons 'let* decl)))

 In Clojure 1.2.0, the preceding definition of let taks the strange
 argument of `form' and `env'. What are they?

user= (defmacro foo [x y] (prn form) (prn env) `(+ ~x ~y))
#'user/foo
user= (let [x 5] (foo x 6))
(foo x 6)
{x #LocalBinding clojure.lang.compiler$localbind...@13f991}
11

form contains the form how the macro was called. env contains local
bindings in the macro environment. (At least this is what my little
test shows...) These magic parameters are given to all parameters, but
usually hidden. It's probably safe to ignore them if you don't know
what they really do.

Sincerely
Meikel

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en