Hi,
Am 20.06.2010 um 01:10 schrieb Michał Marczyk:
> (defn fact [n]
> (loop [n n r 1]
>(if (zero? n)
> r
> (recur (dec n) (* r n)
Maybe I'm spoiled by OCaml, but why can't things be inferred?
n - We don't know.
1 - primitive
r - primitive
zero? - We don't know because of n.
d
Hi Viksit,
I would suggest that the CL loop construct and the Clojure construct
of the same name are, in fact, fairly different beasts, both
structurally and in terms of their goals. I don't believe that Rich
has any intent to extend loop towards the CL flavored loop. The for
construct is more Clo
On Jun 19, 9:02 pm, Aaron Cohen wrote:
> On Sat, Jun 19, 2010 at 11:22 PM, Mike Meyer
> wrote:
>
> > "Rob Lachlan" wrote:
>
> >>Actually, Mike, your two functions work just fine. (Equal branch).
> >>Mind you I checked that out over two hours ago, so this information
> >>might be out of date.
>
It seems to me that there is mainly 2 categories in this thread:
- people that are worried about the difficulty to understand and to code
with the throw-on-overflow semantic. They worry about untested cases
showing in production code and the steeper learning curve of the language.
(I am not of th
Thank you very much Rob and Michal, both issues are clear now.
Michael, I agree that the documentation for clojure.set/project could
improve. At least now there is your email to be sent around to those
like me who don't get it from the very succinct default doc string.
Albert
--
http://albert.ri
On Jun 19, 2010, at 15:58 , Rich Hickey wrote:
> I am telling you though, if you continue with these "show stopper", "will
> keep people from using Clojure" sky-is-falling histrionics, I will stop
> reading your messages.
My apologies here, simple reason is I love clojure and it is one of the
David Nolen writes:
> Using loop/recur is already the beginning of code smell for anything
> that is not performance sensitive.
[...]
In your arity-overloaded example, is there any runtime cost to figure
out which of the two overloads to choose each time `recur' evaluates?
--
Steven E. Harris
On Sun, Jun 20, 2010 at 2:34 PM, Heinz N. Gies wrote:
>
> To 3)
> To the third thing and in my eyes this is the most challenging and
> problematic issue. loop in current clojure is not statically typing (of
> cause it is but it tosses objects in any field so you can pass whatever you
> want and i
On Jun 20, 2010, at 17:57 , Nicolas Oury wrote:
> With what I think is 1.2-MASTER, a few weeks old (I start to be a bit lost
> with many clojure.jar):
>
> user=> (loop [i (long 1)] (recur :a))
> # java.lang.IllegalArgumentException: recur arg for primitive local: i must be
> matching primitive
> A flag like *warn-on-boxing* can help to identify these spots. These works
> for all kind of things. Not only for contrived fact and fib exampls.
+1.
I think something like *warn-on-boxing* would be helpful. I'd use it.
--
You received this message because you are subscribed to the Google
Gro
Hi Brenton:
I think it would be nice if rather than specifying the columns of each
table in the call to the model macro, it was extracted from the
database directly.
Raph
On Jun 14, 6:14 pm, Brenton wrote:
> Hello group.
>
> I have been working on a relational mapping library for Clojure named
I've been reading this thread, and there's good arguments being made
both ways - I've just been reading with interest. But after seeing the
factorial function that won't compile without hints/casts, I feel I
have to speak up.
I wrote a book on Clojure. It's a short book. That's because Clojure
is
On Sun, Jun 20, 2010 at 12:57 PM, Luke VanderHart wrote:
> anything that would mean I'd have to explain the intricacies of
> primitives, boxing, hinting and casting in an "Intro to Clojure"
> course. As much as humanely possible, that should be reserved for the
> "Performance coding in Clojure" s
2010/6/20 David Nolen :
> This begs the question: Is loop/recur an advanced / performance coding
> topic?
> (defn fact [n]
> (reduce *' (range 1 n)))
no
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@g
Like Luke, I have been reading this thread with interest. For what it's
worth, I'm in basic agreement with him.
I might take it a step further. I don't think anyone should have to think
about boxing and primitives when writing standard idiomatic code -- code
that uses +, *, loop, and recur. The jo
As Rich has mentioned a couple times, though, let's be careful not to
conflate "bounded integers" with "unsafe integers." In the proposed
system, an overflowing number would throw an exception. Presumably the
documentation would make it very clear what the behavior of numbers
is. That's not unsafe
Yes, you're right. I wasn't suggesting that someone without an understanding
of static types in general or Java types in particular would be liable to
write *unsafe* code. I was saying that he or she might be prone to writing
code that produces runtime exceptions, and that these exceptions might no
Every code is prone to produce runtime exceptions on some input (mainly
StackOverflow or OutOfMemory).
That's just one more reason to produce.
I agree that it is one harder to grasp for a non computer scientist, but it
is quite a simple one to manage for the more advanced user.
There is a difficul
I find these compromises quite
acceptable. Tuning code has always
been a last step in most dev. projects
I worked on except a few and I worked
on many resource constraint
platforms.
All languages I encountered had a
"default" integer/float implementation
and getting away from it rarely
occured bu
On Sun, Jun 20, 2010 at 11:30 AM, Nicolas Oury wrote:
> I don't believe overflow exception is hard for a beginner. (They know how an
> integer is stored in a computer), but they should not need to write any
> annotations.
I agree with Nicolas. An overflow says "you did math that doesn't work
with
I agree with Nicolas. An overflow says "you did math that doesn't work
with basic numbers" and pretty much everybody coming to computers via
any path may encounter that from time to time. It's basic stuff.
There's a distinction between knowing that something can occur, and
expecting to have to
Actually, that's worst. Most language we grew up with, and most languages I
taught, had fact( someLargeNumber ) = 0 very fastly.
(Which is harder to explain, but explainable)
At least, throw on overflow is safe!
On Sun, Jun 20, 2010 at 8:04 PM, Sean Corfield wrote:
> That's probably colored by my
On Sun, Jun 20, 2010 at 8:46 PM, Richard Newman wrote:
> The question here is whether Clojure is a "primitive" language, where
> numbers are machine numbers by default, or a "modern" language, where
> getting primitive math might require input from the programmer, but by
> default all operations
On Jun 20, 2010, at 22:03 , Nicolas Oury wrote:
> primitive vs modern might not be the right terminology.
The main issue I see is not that primitives vs boxed I think when it is done
right both will be accepted by the community, the main issue I see is the
consequences primitives cause when it
> This is interesting.
>
> One set of folks considers non-machine-number performance to be surprising,
> and wants to avoid it.
>
> Another set of folks considers the possibility of arithmetic exceptions for
> certain combinations of input to be surprising, and wants to avoid them.
>
> Nobody likes
Is it possible to load up .clj files from the classpath of an arbitrary
java app? For example, could you proxy HttpServlet and run your servlet
as a .clj from within a servlet container? If not, and you have to
gen-class the servlet, could the servlet bootstrap the clojure
environment and proce
On Jun 19, 10:55 am, Aaron Bedra wrote:
> Jared,
>
> There was another post about issues with netbeans. I am looking into why
> this is happening. On another note, labrepl uses clojure 1.2, but that is
> all handled via leiningen.
>
Are you sure it requires 1.2? As far as I know clojure 1.2 d
I believe I found out the problem, although I do not know how to fix
it. The RelevanceLabRepl project is missing the nbproject folder. A
working nbproject folder has a lot of files in it, and I don't know
what values to put in by hand. If someone who can create a working
netbeans LabRepl project on
On Jun 18, 8:43 am, Craig Andera wrote:
> > I'm a little confused over when to use a var vs. a ref vs. an agent
> > vs. an atom. For writing small (<200 lines) single-threaded programs
> > when do I want to use each one?
>
> In addition to the great answers you got here, you could have a look
> at
To save my life, I can't get Snow Leopard, Aquamacs, Clojure, and Slime
to work. I have installed Aquamacs 2.0, then ELPA, then the packages
/clojure-mode/, /slime/, and /slime-repl/. (I have also tried to install
the packages /clojure-test-mode/ and /swank-clojure/, but in each case
am told "
Hi!
I'm all new to Clojure. And to functional programming in general
except for some Scheme and ML work in college way back when...
How would I learn Clojure without being connected to the internet?
IOW. What do I need to download so that I can sit on a mountain top
and teach myself?
M.
--
You
On 19 June 2010 15:26, cageface wrote:
> Maybe it's only because I'm coming from Ruby, in which number
> promotion is automatic and everything is slow, but if I have to choose
> between correctness and performance as a *default*, I'll choose
> correctness every time. I think there's a good reason
I have been using Clojure for just under a week, but ...
I have been using CL for almost three years now and have lately been
looking
at and actually using Clojure. I think that it should be easy to write
correct code then put it a bit of work later to make it fast.
On Jun 18, 12:44 pm, Christoph
1. Loading .clj files
Is it possible to load up .clj files from the classpath of an
arbitrary java app? For example, could you proxy HttpServlet and run
your servlet as a .clj from within a servlet container? If not, and
you have to gen-class the clojure servlet class, could the servlet
bootstrap t
On Sun, 20 Jun 2010 13:27:01 -0400
David Nolen wrote:
> On Sun, Jun 20, 2010 at 12:57 PM, Luke VanderHart > wrote:
>
> > anything that would mean I'd have to explain the intricacies of
> > primitives, boxing, hinting and casting in an "Intro to Clojure"
> > course. As much as humanely possible,
Other than downloading clojure and clojure.contrib itself, I'd suggest you
get the "progmraming in clojure" book by Stuart Halloway.
Book in hand, try out the examples in clojure REPL. That's good enough
to get started.
Welcome!
On Sun, Jun 20, 2010 at 3:50 AM, Martin Larsson
wrote:
> Hi!
> I'm
The -main method is for java interop.
Together with :gen-class in the ns-operation, it generates a method
with the following layout:
public static void main(String [ ] args);
which correspondents to the java naming convention for the main method.
This generates a .class file and finally a .jar wh
The arguments seem to be winding down, so I thought this would be a
good time to summarize my thoughts.
My favorite option of those proposed is:
+, *, -, inc, dec auto-promote.
loop/recur is changed so that primitive bindings are boxed.
+',*',-',inc',dec' give error upon overflow.
A new construct,
I would expect a library to internaly
work with whatever is the best
implementation and provide an API
to allow callers using another implementation to use it.
I also expect a library to complain
about a potential overflow
and maybe some precision loss.
That's not different from what you can
see
hey all,
just released a little project to make my own life
easier. might be useful to others, especially clojure noobs
on *nix boxes.
http://github.com/polypus74/cajual
it contains a few bash scripts, to run a clojure file, get a repl,
and run a swank server, easily adding classpaths, and with
hi all,
just released a library for generating renderman RIB
from clojure.
in case you don't know renderman is a standard
published by pixar for doing photorealistic computer
generated imagery.
http://github.com/polypus74/cljman
feedback and collaborators welcome,
_c
--
You received this mess
On Sun, Jun 20, 2010 at 8:19 PM, Mark Engelberg wrote:
> My favorite option of those proposed is:
> +, *, -, inc, dec auto-promote.
> loop/recur is changed so that primitive bindings are boxed.
> +',*',-',inc',dec' give error upon overflow.
> A new construct, loop', is introduced that doesn't box
"David Nolen" wrote:
>On Sun, Jun 20, 2010 at 8:19 PM, Mark Engelberg
>wrote:
>
>> My favorite option of those proposed is:
>> +, *, -, inc, dec auto-promote.
>> loop/recur is changed so that primitive bindings are boxed.
>> +',*',-',inc',dec' give error upon overflow.
>> A new construct, loop'
On Thu, Jun 17, 2010 at 11:14 PM, Howard Lewis Ship wrote:
> I've been using Lein in earnest the last couple of days, prepping for
> a talk on Clojure for OSCON. I'm hitting enough issues to make me
> think that 1.2 needs a bit of TLC before a release.
I'm looking through the tickets you reported
The do form (see http://clojure.org/special_forms#do) only
encapsulates forms and returns the value of the last form evaluated.
The forms generally perform some side effect (otherwise they would be
superfluous). An example of where it's useful is with an if...
(if some-pred return-something
(do (
On Jun 21, 2010, at 2:19 , Mark Engelberg wrote:
> The arguments seem to be winding down, so I thought this would be a
> good time to summarize my thoughts.
>
> My favorite option of those proposed is:
> +, *, -, inc, dec auto-promote.
> loop/recur is changed so that primitive bindings are boxed
Wrappers for OpenCL have been discussed a few times on this list, so
hopefully a few of you will be interested to hear that one is
available at http://github.com/ztellman/calx.
In my opinion, the C-variant language used by OpenCL doesn't have too
much incidental complexity, so I don't think I'll s
> 1. Loading .clj files
> Is it possible to load up .clj files from the classpath of an
> arbitrary java app? For example, could you proxy HttpServlet and run
> your servlet as a .clj from within a servlet container?
Hi Todd, here's a pattern for doing what you want;
1.) Create svlt/Svlt.clj as b
48 matches
Mail list logo