Thanks for the info. I'd need to research how clojure.lang.BigInt
differs from java.math.BigInteger, but I'm sure that adding the extra
case for BigInt in the multimethods wouldn't be too hard.
I'm still stumped as to why expt and sqrt would be 100x slower. My
first thought is that the loop/recu
Hmmm. I did some additional experiments using the JRockit JVM on
Windows XP, and JRockit not only has equivalent memory usage for
Clojure 1.2 and 1.3 alpha1, but it can also run these programs with
significantly less memory than HotSpot. HotSpot is similar, but not
identical, in its memor
I am a macro newbie... I want to create a macro that calls a function
with a given name and a parameter list on a given object. My first
idea was like this:
(defmacro call
"Calls an instance method on a given object with a list of params."
[obj method-name params]
`(. ~obj ~(symbol method-na
i am trying to use lazytest with eclipse + ccw ?
lazytest.watch does not work for me so far.
so i run my lazytests via:
(ns myapp.runtests
(:require lazytest.runner.console
lazytest.color
lazytest.report.nested))
; switch ansi-coloring off
(lazytest.color/set-colorize false)
Hi all,
I'm trying to output the items from a sequence into a HTML list using
the Hiccup HTML builder, but am having problems.
Here is the code I think 'should' work, but nothing after the ':ul' is
passed back to the response:
(html
[:html
[:body
[
I found the old thread below, but unfortunately the solution isn't
working for me. If I have a foo.clj file in a buffer and evaluate
region on
(defn foo [] (+ 1 2))
I get
#'user/foo in the minibuffer. If I then evaluate region on
(foo)
I get 3 in the minibuffer. The slime REPL is giving me a p
doseq do not return anything. (It is for side-effect only).
You might be looking for 'for'.
(doc for)
-
clojure.core/for
([seq-exprs body-expr])
Macro
List comprehension. Takes a vector of one or more
binding-form/collection-expr pairs, each followed by zero or more
Difficult problem.
macro are syntactic tools. So they are not made to evaluate things at runtime.
You could expand to something that call eval at runtime but it is not
a good idea (It involves the compiler at each call)
If your (rest alist) is known at macro-expansion time, then it can
work but to
Hi,
2010/9/27 faenvie
> i am trying to use lazytest with eclipse + ccw ?
>
You note that you're using ccw, is that because you have a clue that there
could be something related to the "lazytest-ccw" combo in the issue you're
facing ?
>
> lazytest.watch does not work for me so far.
> so i run
Nicolas,
Yes, that's solved the problem. Many thanks for you swift help.
Paul.
On Sep 27, 12:12 pm, Nicolas Oury wrote:
> doseq do not return anything. (It is for side-effect only).
>
> You might be looking for 'for'.
>
> (doc for)
> -
> clojure.core/for
> ([seq-exprs bo
> Anyone know any command line options for HotSpot that make it work harder to
> compact things down into the smallest space possible, no matter what? I am
> aware of several pages of documentation on HotSpot's GC options, and I've
> been reading some of them, but it is a lot to wade through.
The
Nice!
--
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
Don't have any specific suggestion at the moment. I'm planning on
adding a REPL runner that will do something similar to the code you
posted.
-S
On Sep 27, 5:52 am, faenvie wrote:
> i am trying to use lazytest with eclipse + ccw ?
>
> lazytest.watch does not work for me so far.
> so i run my laz
There is a movement afoot in the common lisp community to
implement quicklisp which is similar to the perl cpan site
or debian. It would be useful if there was a quicklisp (or
asdf) for Clojure. Thus you could "apt-get" a library for
clojure.
Tim Daly
On 9/27/2010 1:47 AM, David Sletten wrote:
It occurs to me that another way of doing this is to map a new list
and then use the min fn. something like:
(apply min (map #(Math/abs (- % 136)) xs))
maybe this is better and involves less calculations?
On Sep 25, 2:19 pm, Glen Rubin wrote:
> min-key looks good! thx guys!!!
>
> On Sep 25,
I have a vector of numbers
[0 99 3334 53 2 5 99 2 55 63]
I'd like to find the first index of a particular value. For example
if the value was 99 then I want to return 1, b/c the index of 99 is
1. I can do this with a loop/recur structure comparing each value in
the list to my desired value, how
On Sep 27, 2010, at 9:28 AM, Glen Rubin wrote:
> It occurs to me that another way of doing this is to map a new list
> and then use the min fn. something like:
>
> (apply min (map #(Math/abs (- % 136)) xs))
>
> maybe this is better and involves less calculations?
That gives you the minimum dis
yes correct. but i can write a fn to determine the index of the
minimum distance in my new list?
that index applied to my original list will give me the value back.
and this still would involve fewer calculations i think.
On Sep 27, 10:50 am, Michael Gardner wrote:
> On Sep 27, 2010, at 9:28 AM
Hi Glen,
Finding the *first* index isn't very Clojurish, what you want is to find *all*
the indexes, lazily. Then if you want the first one, just call first.
(use '[clojure.contrib.seq-utils :only (positions)])
(positions #{99} [0 99 3334 53 2 5 99 2 55 63])
-> (1 6)
Cheers,
Stu
> I have a vec
On Sep 27, 2010, at 9:45 AM, Glen Rubin wrote:
> I have a vector of numbers
>
> [0 99 3334 53 2 5 99 2 55 63]
>
> I'd like to find the first index of a particular value. For example
> if the value was 99 then I want to return 1, b/c the index of 99 is
> 1. I can do this with a loop/recur struc
On Sep 27, 2010, at 9:59 AM, Glen Rubin wrote:
> yes correct. but i can write a fn to determine the index of the
> minimum distance in my new list?
>
> that index applied to my original list will give me the value back.
> and this still would involve fewer calculations i think.
Do you have a pa
very good!
On Mon, Sep 27, 2010 at 1:12 PM, Tim Daly wrote:
> There is a movement afoot in the common lisp community to
> implement quicklisp which is similar to the perl cpan site
> or debian. It would be useful if there was a quicklisp (or
> asdf) for Clojure. Thus you could "apt-get" a libra
I believe
http://clojars.org
is intended to fill the purpose you describe, except using Leiningen
or Maven instead of apt-get. I do not know yet how good its inter-
library dependency info is, but there is some there.
Andy
On Sep 27, 2010, at 9:12 AM, Tim Daly wrote:
There is a movement
On Sep 25, 11:41 am, Glen Rubin wrote:
> I have a list of numbers and I want to find the one that is closest to
> 136. Is there an operator for performing this kind of operation or do
> I need to to do it algorithmically?
I think the normal way to do this is a k-d tree:
http://en.wikipedia.org/
Thanks for your reply :)
The context: I am developing a wrapper generator that takes a Java
class and generates a Clojure wrapper, with a function for each method
etc. The purpose is to have nice wrappers, so your code is "cleaner"
as with all that Java calls. And it can ba a basis for more conven
ok, thx. just trying to keep myself to a high standard while learning
this stuff ;)
On Sep 27, 11:12 am, Michael Gardner wrote:
> On Sep 27, 2010, at 9:59 AM, Glen Rubin wrote:
>
> > yes correct. but i can write a fn to determine the index of the
> > minimum distance in my new list?
>
> > that
interesting! thx guys!
On Sep 27, 10:45 am, Glen Rubin wrote:
> I have a vector of numbers
>
> [0 99 3334 53 2 5 99 2 55 63]
>
> I'd like to find the first index of a particular value. For example
> if the value was 99 then I want to return 1, b/c the index of 99 is
> 1. I can do this with a l
I have a function that will accept 3 or 4 parameters. Another
function I have calls it and passes in 4 arguments. Sometimes, the
4th argument is nil and this causes an error, instead of just calling
the main function as if I passed in 3 arguments. Meaning the main
function sees a 4th parameter w
(defn f
([a b c] ...)
([a b c d]
(if d
...
(f a b c
Not the prettiest solution, I'll grant you; I'm sure someone will come
along with something better. But this will work.
On Sep 27, 11:13 am, Glen Rubin wrote:
> I have a function that will accept 3 or 4 parameters.
It's a noob question... I know
But in my studies I use REPL 80% of the coding time.
More advanced users still uses REPL so many times?
thanks.
-- christian guimaraes
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send e
Why not?
The only thing I found very practical (even though it does not yet work 100%
(like autoloading the open code in the repl) for me) is the possibility to
fire of longer commands and function definitions (or the like) in Slime (or
vi-equivalent).
The repl is a great way to debug your though
I recognize that one. The repl haven't loaded the file your editing.
My (temporary) solution is to do a (load-file "")
after each edit that I want to debug, but that's a bit boring. I guess there
is some kind of reload feature somewhere...
/Linus
2010/9/27 psfblair
> I found the old thread bel
A lot. By that, I mean that probably 80% to 100% of the time the REPL is
running waiting for your command.
And what may change is that you may more and more "send" code to the REPL
from your favorite editor.
2 flavors :
* keep the full control on what is emitted to the REPL. There are
shortcuts
I use REPL quite a bit. Especially if I'm quickly trying to throw
something together.
I'd use vimclojure and REPL.
In intelliJ, I use REPL for brain storm and testing.
On Mon, Sep 27, 2010 at 3:14 PM, Christian Guimaraes
wrote:
> It's a noob question... I know
>
> But in my studies I use REP
The following program compiles and runs perfectly fine in both 1.2 and
1.3 alpha1. It has no reflection warnings in 1.2, but it does in 1.3
alpha1. I have tried several variations, but I haven't yet been able
to figure out how to write type declarations that avoid reflection in
1.3 alpha1
C-c C-k in the .clj buffer is easier and equivalent (or at least very
similar)
On Sep 27, 12:27 pm, Linus Ericsson
wrote:
> I recognize that one. The repl haven't loaded the file your editing.
>
> My (temporary) solution is to do a (load-file "")
> after each edit that I want to debug, but that's
Here's one popular form:
(defn foo
([a b c] (foo a b c nil))
([a b c d] (if d ...)))
Most multi-arity functions have the same behavior for every arity,
with some default argument values.
-S
On Sep 27, 2:13 pm, Glen Rubin wrote:
> I have a function that will accept 3 or 4 parameters. Anoth
That's weird. I see no reflection warnings when loading this on 1.3 alpha 1.
Stu
> The following program compiles and runs perfectly fine in both 1.2 and 1.3
> alpha1. It has no reflection warnings in 1.2, but it does in 1.3 alpha1. I
> have tried several variations, but I haven't yet been a
While toying with the Sesame2.3 library, I've come across the
following behavior for the first time.
This is taken from the api doc for
org.openrdf.repository.base.RepositoryConnectionBase:
add(Resource subject, URI predicate, Value object, Resource...
contexts)
Adds a statement with th
OK, so I happened to stumble across a fix to my program, but I still
wonder whether this is intentional behavior in 1.3 alpha1 or not.
If I change the name 'nbody' in these lines:
(let [^Body nbody other
dx (- x (.x nbody)) ; first reflection warning here
dy
I don't know if it makes a difference, but I was doing AOT compilation
on a file nbody.clj containing the program in my message.
I replied to my own message with a workaround that it seems to be
related to the variable 'nbody' having the same name as the one in the
'ns' declaration.
Thank
I suppose I've been looking at this code for too long, so I need a 2nd pair
of eyes on it. I'm not getting some 'test.is' code to run. I'm trying to run
the tests as in fig. 1. Suppose the tests are defined in a file called
utests.clj (fig. 2).
(use 'clojure.test)
(require 'utests)
(run-tests 'ut
The vararg at the end of the method is just syntactic sugar for an
array, so the "add" method actually takes 4 args, the last being a
Resource array. The java compiler just replaces "missing" varargs
with an empty array.
My guess is that the reflection mechanisms in the compiler just look
at type
Tim Daly writes:
> There is a movement afoot in the common lisp community to implement
> quicklisp which is similar to the perl cpan site or debian. It would be
> useful if there was a quicklisp (or asdf) for Clojure. Thus you could
> "apt-get" a library for clojure.
FWIW, having just started ou
On Mon, Sep 27, 2010 at 4:03 AM, psfblair wrote:
> I found the old thread below, but unfortunately the solution isn't
> working for me. If I have a foo.clj file in a buffer and evaluate
> region on
>
> (defn foo [] (+ 1 2))
>
> I get
>
> #'user/foo in the minibuffer.
What does your ns form look l
Daniel,
If you install lein-search (http://clojars.org/lein-search or
http://github.com/Licenser/lein-search) you can do searches like that.
lein search mail
If you put it in ~/.lein/plugins it will work for all your lein projects and
you can even use it to add what you find to your project.clj
hi,
apologies if this is a long question, i would appreciate some guidance here.
i am creating a clojure wrapper around a rather verbose low latency
messaging framework. the main things you can do are publish messages,
receive messages, initialize sources and receivers etc. all are done
through a
cake (http://github.com/ninjudd/cake) has the "tab completion"
feature.
Because this is very useful, I wonder if this feature should be added
to leiningen or Clojure itself.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send
Hi,
I'm not sure my solution is 100% idiomatic, but has some advantages.
General strategy: minimise macro usage. Macros are cool, but
overrated. Put as much as possible into functions. This has several
advantages like easier testing, less macro trap doors, better
readability (no # all over the pla
49 matches
Mail list logo