On May 3, 5:22 pm, André Thieme splendidl...@googlemail.com wrote:
Am 02.05.2011 23:14, schrieb David Nolen:
The relevant clojure-dev thread.
http://groups.google.com/group/clojure-dev/browse_thread/thread/f4907...
It's not clear whether the core team and the various contributors are
On May 4, 8:50 am, Simon Katz nomisk...@gmail.com wrote:
For example Common Lisp does support this.
That's not true, or at least it's only partly true.
Here's a translation of your example into Common Lisp (I added a use
of a# in the macro to avoid compiler optimization making the problem
You can use the erlang-otp Java library from Clojure.
I think there are bindings on github. If not, they are simple to
generate.
(I actually had clojure hooked up to a yaws webserver (yaws pattern
matches requests, clojure generates pages) for a while, using LFE and
the OTP libraries. Clojure
You might want to read through the source of scriptjure:
https://github.com/arohner/scriptjure
For one way to do this sort of thing. Pretty much, you would make a
basic recursive descent parser that operates on a tree of clojure
primitives. You could then wrap this in a macro, and go from there.
I'm wondering if it wouldn't be better to simply implement it using a
mutable 2d Java array? (the standard imperative implementation).
It wouldn't be a 'purely functional' answer, but the array wouldn't
leak out of the levenshtein-distance function.
On Mar 22, 3:09 am, Christian Schuhegger
Here is a way that should work.
(let [missing (gensym)]
(defn get-with-exception [map key]
(let [res (get map key missing)]
(if (= res missing)
(throw (new Exception my-exception))
res
Gensyms are unique so you also don't have the problem of 'what happens
if I
Ah, interesting.
You'll notice that the gensym is created outside the defn and
captured, so I'm not sure speed is important.
On Mar 21, 11:26 am, Mikhail Kryshen mikh...@kryshen.net wrote:
On Mon, 21 Mar 2011 07:52:45 -0700 (PDT)
Jonathan Smith jonathansmith...@gmail.com wrote:
Here is a way
Actually I've got to disagree here, it is really easy to do.
Here is one example of something esessoms did:
http://github.com/esessoms/clj-interface
And here is an example of the rewrite I did when I decided that his
version didn't quite do what I wanted.
http://gist.github.com/369114
On Apr
A function would be named based on what it is that it does.
Difficulty naming functions would imply to me that the functions
involved do not contain a clear functionality.
The names of the functions should sort of be an 'emergent property' of
a larger process of reasoning through the programming
Lisp Flavored Erlang is an extremely interesting lisp. in my opinion.
You get Erlang, and you also get s-expressions and macros.
Common Lisp and Scheme are the obvious choices, I suppose.
Learning common lisp I would probably go towards clozure common lisp,
or clisp.
(SBCL is fine (great,
--
is still slow, but dropping down to
(def wlistdata (to-array (take 26 (words-with ...
(def update-wlist #(let [w (take 26 (words-with (current-word)))]
(. words setListData wlistdata)))
leaves everything running smoothly. Is there a more efficient
On Nov 25, 2:09 pm, Martin DeMello martindeme...@gmail.com wrote:
On Thu, Nov 26, 2009 at 12:31 AM, Jonathan Smith
jonathansmith...@gmail.com wrote:
I think a better way to do this is to not use a regex at all.
Canonically I think this sort of thing is (would be?) implemented
Maybe I'm confused, but can't you just do a regular java thread for
this?
(defn periodicly [fun time]
starts a thread that calls function every time ms
(let [thread (new Thread (fn [] (loop [] (fun) (Thread/sleep time)
(recur]
(.start thread)
thread))
(periodicly #(println foo
When figuring these things out it can sometimes help to look at the
implementations of stuff like defn (in clojure.core).
I'll leave it as an exercise to you, but you should note that you may
want to name-space qualify the database (depending on what you are
doing with it and where the database
its fine in firefox 3.0.14 on Ubuntu here.
On Oct 11, 5:29 pm, Raoul Duke rao...@gmail.com wrote:
it seems to get chopped off part way down the page for me, of late.
(it doesn't get chopped off in ie for me.)
--~--~-~--~~~---~--~~
You received this message
I use a let at the top of the file to denote things that I want to
have as captured and constant.
... you can do things like
(let [x 1]
(defn foo-that-uses-x [y]
(function-here x y)))
On Oct 2, 10:29 am, Mark mjt0...@gmail.com wrote:
Is there a way to make a declaration in Clojure that
On Sep 30, 1:18 pm, Matt Brown mrbrow...@gmail.com wrote:
Hi.
Thanks all, for your comments.
You need to use a bigger number than 1000 for these results to be
meaningful.
Out of curiousity, why is this?
Does the JIT do something different after 1000 iterations?
Or is the concern
You need to use a bigger number than 1000 for these results to be
meaningful.
FWIW, I've run both on my Toshiba dual core laptop with ubuntu, and
they return approximately the same values.
(and there is some JIT trickery going on, as I got:
user= (myavgtime (+ 1 2 3) 1000 mytime1)
(myavgtime (+
On Sep 27, 9:17 am, Timothy Pratley timothyprat...@gmail.com wrote:
As far as I can tell there is currently no way to hint 2d array access
fast
(def a (make-array Double/TYPE 100 100))
(time (doseq [i (range 100), j (range 100)] (aget a (int i) (int j
Elapsed time: 836.800335 msecs
I
subject, and probably not worth
worrying about for the minimal speed difference that it makes.
Interesting though,
-Jon.
On Sep 28, 2:45 am, Jonathan Smith jonathansmith...@gmail.com wrote:
On Sep 27, 9:17 am, Timothy Pratley timothyprat...@gmail.com wrote:
As far as I can tell
I find loop recur kind of hard to follow sometimes
I was browsing through this pdf the other day:
http://www.cs.umbc.edu/331/resources/papers/Evolution-of-Lisp.pdf
And I found the tail recursive definition of common lisp/scheme style
do.
Thoroughly intrigued, I implemented it:
(defmacro
Hi!
This is happening because you have integers saved to a global
variable.
(iterate inc 1) creates an infinite lazy seq.
Def-fing it to a global says 'Hey, i might want this later!' to
Clojure.
This means that as you take numbers from integers;
they get saved in memory rather than being
http://www.haskell.org/haskellwiki/Performance
These are the performance tips I was referring to.
(4. General techniques, laziness, space leaks.)
On Sep 18, 5:03 pm, Jonathan Smith jonathansmith...@gmail.com wrote:
Hi!
This is happening because you have integers saved to a global
variable
It would be kind of nice to have some sort of uniform identifier for
laziness similar to ! for destructive and ? for predicate.
On Sep 18, 5:10 pm, Raoul Duke rao...@gmail.com wrote:
Runs (in a nice constant memory) even though yours (which almost
appears equivalent) will not!
i am
Just out of curiosity, is there any technical reason that you decided
to use signals instead of passing closures?
(Modularity; Efficiency; more idiomatic to Java?)
On Sep 6, 5:29 am, rb raphi...@gmail.com wrote:
On Sep 4, 8:30 pm, Jonathan Smith jonathansmith...@gmail.com wrote:
Hi Ralph
Are we sure that it is the aset-* operation that is causing a slowdown
and not the fact that the aset-* operations are not being inlined,
whereas the regular aset operation is?
If so, the aset-* ops might be faster, and just in need of a small
update!
A lot of the time when something is slower
Hi Ralph,
First off, nice post! We need more of these types of tutorials on GUI
in clojure, they're very useful.
On make-login-widget you can probably do a doto when you do this part:
(.addWidget layout (WLabel. Login:) 0 0 )
(.addWidget layout login-field 0 1 )
(.addWidget layout (WLabel.
On Aug 29, 3:48 pm, ronen nark...@gmail.com wrote:
In a lot of cases its seems that macros are used even when a function
can do the same task,
Macros seems to be less readable than their functional counterparts
more complex to write (to me at least).
Its clear that there are special
its not impossible, it just isn't terribly useful.
On Aug 26, 6:04 pm, Laurent PETIT laurent.pe...@gmail.com wrote:
they didn't know it was impossible so they did it :)
2009/8/26 Stuart Sierra the.stuart.sie...@gmail.com
On Aug 24, 11:23 pm, wangzx wangzaixi...@gmail.com wrote:
I
On Aug 25, 11:28 am, B Smith-Mannschott bsmith.o...@gmail.com wrote:
On Tue, Aug 25, 2009 at 16:24, Licenserheinz.g...@gmail.com wrote:
Hi everyone,
I wonder what is the reason clojure uses XML standard wise and not
JSON. In the past I've found that JSON is much cleaner to read, and
Why not make a list of numbers from 0 to max, randomly shuffle it,
and do a take on the resulting sequence until you have enough numbers.
On Aug 25, 10:16 am, sebastien sebastien@gmail.com wrote:
What is the most efficient way to generate list of unique random
numbers? The function must
[max dim]
(take dim (shuffle-java (range 0 max
user (random-number-list 100 20)
(38 70 73 57 10 81 32 99 92 19 77 39 27 24 47 17 86 8 58 76)
On Aug 25, 1:30 pm, Jonathan Smith jonathansmith...@gmail.com wrote:
Why not make a list of numbers from 0 to max, randomly shuffle it,
and do a take
I would have worried that if dim and max were close you'd get to the
last number and keep calling #(rand-int) and never hit the last
number.
how does distinct work that it keeps that situation from occuring?
On Aug 25, 12:26 pm, Christophe Grand christo...@cgrand.net wrote:
no, distinct uses a
On Aug 14, 3:43 pm, Fogus mefo...@gmail.com wrote:
Wanna play golf?
ok...
Not efficient or elegant, but certainly weird...
(defn filter-collecting [p c seqs]
(let [fun #(if (apply p %1)
(conj! %2 (apply c %1))
%2)]
(loop [hs (map first seqs)
ts
On Aug 14, 11:46 am, Brian Hurt bhur...@gmail.com wrote:
On Thu, Aug 13, 2009 at 4:59 PM, Daniel Lyons fus...@storytotell.orgwrote:
On Aug 13, 2009, at 2:30 PM, Brian Hurt wrote:
I'm just wondering what people's response would be to allow user-generated
reader macros. I'm not sure,
On Aug 10, 11:08 pm, fft1976 fft1...@gmail.com wrote:
On Aug 10, 2:19 pm, Jonathan Smith jonathansmith...@gmail.com wrote:
1.) use something mutable
2.) unroll all the loops (mapping is a loop)
3.) try not to coerce between seq/vec/hash-map too much.
Are you saying this w.r.t. my code
On Aug 11, 4:42 am, fft1976 fft1...@gmail.com wrote:
On Aug 10, 11:42 pm, Jonathan Smith jonathansmith...@gmail.com
wrote:
The way your code is setup, you will spend a lot of time in funcall
overhead just because you used a lot of functions instead of doing the
calculation in bigger
has the added wrinkle of namespace
qualification.
On Aug 11, 1:31 am, Jonathan Smith jonathansmith...@gmail.com wrote:
On Aug 10, 3:20 pm, Dragan Djuric draga...@gmail.com wrote:
For example:
(defmacro creator [param]
`(defmacro created [p] `(the code...)) ;; note the nested quote
On Aug 11, 2:43 pm, fft1976 fft1...@gmail.com wrote:
On Aug 11, 4:50 am, Jonathan Smith jonathansmith...@gmail.com wrote:
I don't think you have to put *everything* in the let, just your
constants. (so days per year and solar mass, the bodies themselves).
How will they escape from
On Aug 10, 3:20 pm, Dragan Djuric draga...@gmail.com wrote:
For example:
(defmacro creator [param]
`(defmacro created [p] `(the code...)) ;; note the nested quote...
how to resolve that? any examples?
Although I wouldn't cite my own code as a necessarily *good* or easy
to understand
I'll second the book recommendation,
have the hacks sitting here on my desk and has been very useful so
far.
I've found that the easiest way for me to do UIs has been to write
helper functions that make the components and stitch them together
then return them inside hashmaps.
Then I write a
On Jul 20, 1:27 am, kyle smith the1physic...@gmail.com wrote:
I'm trying to use Stuart Sierra's implementation of cells. I want to
sum the values of a large number of cells. Rather than linearly
summing all the values, I would like to create a tree of cells whose
root contains the sum. I
On Jul 14, 5:12 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:
On Jul 14, 3:01 pm, bgray graybran...@gmail.com wrote:
Ok, so *if* this is intended behavior, what have people been doing to
bind variables dependant on other bindings? I can't be the first to
run into this.
Just
On Jul 13, 5:51 pm, Morgan Allen alfred.morgan.al...@gmail.com
wrote:
It's definitely not necessary to implement the bulk of your code in Java to
get performance. On the other hand, getting performance out of Clojure can
be tricky.
Well, yeah, that's the thing- getting maximal
On Jul 7, 5:10 pm, John Harrop jharrop...@gmail.com wrote:
Problem: Passing primitives from an inner loop to an outer loop efficiently.
Here is what I've found.
The fastest method of result batching, amazingly, is to pass out a list and:
(let [foo (loop ... )
x (double (first foo))
r1
On Jul 8, 4:57 pm, Frantisek Sodomka fsodo...@gmail.com wrote:
So far it seems that vectors win in Clojure:
(timings 3e5
(let [v (vector 1 2 3) a (nth v 0) b (nth v 1) c (nth v 2)] (+ a b
c))
(let [lst (list 1 2 3) a (nth lst 0) b (nth lst 1) c (nth lst 2)] (+
a b c)))
=
680.63 ms
Seperate so it can be easily ignored:
Changed in core.clj:
(defn nth
Returns the value at the index. get returns nil if index out of
bounds, nth throws an exception unless not-found is supplied. nth
also works for strings, Java arrays, regex Matchers and Lists, and,
in O(n) time, for
On Jul 6, 6:00 pm, Chouser chou...@gmail.com wrote:
On Mon, Jul 6, 2009 at 4:18 PM, Meikel Brandmeyerm...@kotka.de wrote:
Hi,
Am 06.07.2009 um 22:00 schrieb Chouser:
Or if you really do need a list:
(for [x [1 2 3]] (cons 'some-symbol (list x)))
o.O
*cough*(list 'some-symbol
On Jun 25, 3:59 pm, Berlin Brown berlin.br...@gmail.com wrote:
On Jun 25, 3:52 pm, Mike Hinchey hinche...@gmail.com wrote:
Instead of eval in the doseq, you could use a macro with a do block,
something like:
user (defmacro deftags [tags]
`(do ~@(map (fn [tag]
49 matches
Mail list logo