Hello,
This should work (I think): (unchecked-divide 1257316459070 1000)
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---
On Tue, Nov 3, 2009 at 1:53 AM, Alex Osborne wrote:
> The new loop uses the outer-let to get around this:
>
> (let [G__13697 s
> [x & xs] G__13697
> y xs]
> (loop* [G__13697 G__13697
> y y]
> (let [[x & xs] G__13697
>y y]
>...)))
>
Now
(into [] (concat [1 2] [3 4]))
Different tools for different jobs. And Mark makes a great point
about assuming too much from a particular usage.
On Nov 3, 7:56 pm, mbrodersen wrote:
> Currently (into) takes 2 parameters (destination and source):
>
> (into [] [1 2]) => [1 2]
>
> but not more
I'm pretty sure there was an example of this using continuations in
Dybvig's book on Scheme. I just flipped through it and didn't readily
find it, but I think that is where I saw it.
On Nov 1, 8:04 pm, CuppoJava wrote:
> Hi,
> For the purposes of a DSL that I'm writing, it would be very
> conve
I agree that seqs carry a large degree of risk. You have to work very
hard to avoid giving your large sequences a name, lest you
accidentally "hang on to the head".
In Clojure's early days, I complained about this and described some of
my own experiments with uncached sequences. Rich said he wa
I'm working the exercises in SICP using Clojure and learning Clojure as I
go. I've stumbled across a mystifying NullPointerException. I'm implementing
exercise 2.23, where you're supposed to implement a "for-each" method that
takes a function and a list of items. It applies the function to teach it
There was a considerable faux pas on my part with the enclojure-
plugin-2009-09-22-patch1.nbm in which I used Java 1.6 to build it.
This release addresses the above as well as some bugs on Windows and
enhancements. Selected highlights from the git log:
> Added support for loading all source fro
On Tue, Nov 3, 2009 at 7:56 PM, mbrodersen wrote:
> It would be nice to have (into) work for more parameters:
>
> (into [] [1 2] [3 4] [5 6 7]) => [1 2 3 4 5 6 7]
If you did this, it would be very easy to get confused and think that:
(into [] [1 2] [3 4] [5 6 7]) would yield [[1 2] [3 4] [5 6 7
> I'd love to hear success stories from people using nailgun to actually
> run frequent scripted tasks out of cron, as opposed to for
> development. It would make clojure more palatable for my work
> environment.
Nailgun has been a boon to me. I don't believe Nailgun has a problem
with dynamic cl
Currently (into) takes 2 parameters (destination and source):
(into [] [1 2]) => [1 2]
but not more than 2:
(into [] [1 2] [3 4]) => Wrong number of args...
It would be nice to have (into) work for more parameters:
(into [] [1 2] [3 4] [5 6 7]) => [1 2 3 4 5 6 7]
--~--~-~--~~
Currently (into) takes 2 parameters (destination and source)
(into [] [1 2]) => [1 2]
but not more than 2:
(into [] [1 2] [3 4]) => Wrong number of args...
It would be nice to have (into) work for more parameters:
(into [] [1 2] [3 4]) => [1 2 3 4]
--~--~-~--~~~--
> I would propose no changes to Clojure, no
> conditional compilation techniques or reader modifications. Just
> things like macros that have simple functionality and that at most
> check one flag to conditionalize output.
I wouldn't immediately object to reader macro conditionalization here.
I forgot to mention that there is still one small issue
https://www.assembla.com/spaces/clojure/tickets/208-pom-uses-old-artifactId
that needs fixed.
org.clojure
clojure-lang
1.1.0-alpha-SNAPSHOT
Until it's fixed you can use ^
On Nov 3, 5:10 pm, dysinger wrote:
> He
Hello,
Today Phil Hagelberg, Rich Hickey and myself setup a CI server for
clojure & contrib -> http://build.clojure.org (hudson -> github)
If you use maven-ant-tasks (+1) or maven 2.x (or ivy too) you can do
something like this in your settings.xml or pom.xml
clojure-snapshot
I have used SyntaxHighligter (http://alexgorbatchev.com/) on my blog
with the Clojure brush from
http://www.undermyhat.org/blog/2009/09/list-of-brushes-syntaxhighligher/
It seems to work fairly well.
/Patrik
On Nov 3, 9:02 am, Christophe Grand wrote:
> pygments (which is used by github) does
I understand the pragmatism of your approach, but it's really
unfortunate. Seqs are a really convenient abstraction, and the ability
to model arbitrarily large or infinite ones (with laziness) is really
useful. In my opinion, only using seqs when all of the data can be fit
into memory really under
In the particular case given below, I'd assume that during the
invocation of print-seq, the binding to "s" (the head of the sequence)
would be retained, because my mental model for the execution
environment of a function is that it is the environment in which they
were declared, extended with the
On Nov 3, 9:41 pm, jan wrote:
> When you only have a single branch in `if' it is more conventional to
> use `when', or in this case `when-not'. And defn sets up a recur point
> so there's no need for the explicit loop either.
I thought "when" was mainly used for side-effects? "if" seems more
app
On Tue, Nov 3, 2009 at 4:22 PM, Brian Hurt wrote:
>
>
> On Tue, Nov 3, 2009 at 4:21 PM, Dean Wampler wrote:
>
>> Ah, of course. Thanks. This works:
>>
>> (defn for-each [f items]
>> (if (not (empty? items))
>> (let [] (f (first items)) (for-each f (rest items)
>>
>>
> Or:
>
> (defn fo
On Tue, Nov 3, 2009 at 4:21 PM, Dean Wampler wrote:
> Ah, of course. Thanks. This works:
>
> (defn for-each [f items]
> (if (not (empty? items))
> (let [] (f (first items)) (for-each f (rest items)
>
>
Or:
(defn for-each [ f items]
> (for-each (fn [x] (println (* x x))) (list 1 2 3
On Nov 3, 9:08 am, Sean Devlin wrote:
> My understanding is that the current expectation is to allow
> differences in the way each platform does its job. Contrib currently
> is expected to behave differently on the CLR and the JVM. For
> example, the str-utils and sql-utils libraries would need
We encountered similar problems at work trying to wrap I/O up into lazy
seq's. The problem is that it is very easy to accidentally hold on to the
head of a seq while enumerating it's elements. In addition, we had problems
with not closing file descriptors. A common pattern was to open a file,
pr
Also Clojure has doseq which defeats the learning exercise but nets a
nicer golf score of 14:
(defn for-each [f items]
(doseq [i items] (f i)))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To pos
On Tue, Nov 3, 2009 at 7:09 PM, dmiller wrote:
> I have a few ideas for this, but welcome design input from anyone
> with an interest.
>
> It's this, or write a a really nasty Perl script. :)
You dare to threaten us??!
:)
--~--~-~--~~~---~--~~
You received this
Brian Hurt writes:
> Of course, you don't have tail call optimization in Clojure (dang jvm). So
> this is probably better:
> (defn for-each [f items]
> (loop [ curr items ]
> (if (empty? curr)
> nil
> (do
> (f (first curr))
> (
Ah, of course. Thanks. This works:
(defn for-each [f items]
(if (not (empty? items))
(let [] (f (first items)) (for-each f (rest items)
(for-each (fn [x] (println (* x x))) (list 1 2 3 4 5))
On Tue, Nov 3, 2009 at 3:13 PM, Kevin Downey wrote:
>
> (f (first items)) => nil
> ((f (fir
It would be very useful for integrating into automated build systems
if clojure.test/run-tests returned a true/false value depending on
whether the tests pass. It's pretty easy to do this by changing
report's :summary method as shown below.
Thoughts?
-Phil
diff --git a/src/clj/clojure/test.clj
On Tue, Nov 3, 2009 at 5:19 PM, Paul Mooser wrote:
>
> I understand the pragmatism of your approach, but it's really
> unfortunate. Seqs are a really convenient abstraction, and the ability
> to model arbitrarily large or infinite ones (with laziness) is really
> useful. In my opinion, only using
(f (first items)) => nil
((f (first items)) (for-each f (rest items))) => (nil (for-each f
(rest items))) => (.invoke nil (for-each f (rest items))) => calling a
method on nil is a NPE
lists are function applications
On Tue, Nov 3, 2009 at 9:33 AM, Dean Wampler wrote:
> I'm working the exercise
Ah -- I hadn't understood that when using destructuring, that
subsequent bindings could refer to the destructured elements. I should
have, since clojure "only" has let*, and this behavior seems
consistent with that, for binding.
Eeww. It seems like quite a thorny issue to solve, even if simple to
> I thought "when" was mainly used for side-effects? "if" seems more
> appropriate if you just want the return value.
It's perfectly appropriate and idiomatic when you want the alternative
return value to be nil, and you don't want to confuse matters by
having a one-element `if`, or an `if` t
My understanding is that the current expectation is to allow
differences in the way each platform does its job. Contrib currently
is expected to behave differently on the CLR and the JVM. For
example, the str-utils and sql-utils libraries would need to be
completely re-written to work w/ the CLR
On Oct 19, 9:25 pm, ngocdaothanh wrote:
> For most programming languages, I only need 2 books: an introduction
> one and a cookbook one.
+1 for a Clojure cookbook. The same combo for Perl was very effective
for me.
-Ross
--~--~-~--~~~---~--~~
You received this m
On Nov 3, 12:03 am, CuppoJava wrote:
> But I'm writing a DSL for others to use. People that don't have
> experience with functional programming, and for them it's easier to
> have a break/return.
That doesn't seem like a good idea to me. Clojure is a functional
programming language; trying to tr
Hi all,
I've been watching the development of ClojureCLR with some interest -
my research group have roughly equivalent APIs in C# and Java and
we're going to want to formalize the arrangement soon. At the same
time I've been using Clojure as a functional JVM lang. It would be
sweet to write this
On Nov 3, 1:43 am, Alex Osborne wrote:
> Sean Devlin wrote:
> > This is slightly unrealted, but how does one pronounce ->, ->> and the
> > like? Is this documented?
>
> The doc-strings usually give you a nice hint. I usually use "thread"
> for -> and "thread last" for ->>. The actual symbols I
pygments (which is used by github) does a good job too.
On Tue, Nov 3, 2009 at 12:41 AM, Stefan Arentz wrote:
>
> I want to post some Clojure code to my blog. Does anyone know of a
> simple, preferably online, code highlighter for Clojure or Lisp that
> turns code into simple html with either a
37 matches
Mail list logo