On Sun, Oct 11, 2009 at 8:55 PM, Angel Java Lopez ajlopez2...@gmail.comwrote:
Hi people!
I just discovered that maps support duplicated keys:
user= {:a 1 :b 2 :a 3}
{:a 1, :b 2, :a 3}
It was not clear to me, from documentation. I presumed that maps are like
dictionaries.
What is the
On Sun, Oct 11, 2009 at 3:17 PM, Daniel Werner
daniel.d.wer...@googlemail.com wrote:
On Oct 11, 6:02 am, samppi rbysam...@gmail.com wrote:
Oops, you're right; I was thinking about something else. And I have
another mistake in my function too—I meant:
(defn transform-map [f a-map]
Here is a quickie library for abstracting this:
(defn make-actor [f period-in-ms initial-state]
(agent (into [f period-in-ms false] initial-state)))
(defmacro actor
Creates and returns a new, initially-sleeping actor with the specified
period, initial parameter values, and code to execute.
On Sat, Oct 10, 2009 at 5:52 PM, Raoul Duke rao...@gmail.com wrote:
The actor itself is
an agent wrapping a vector with the function, period, awake flag, and
current parameters.
will actors actually do the queued function w/in a reasonable
timeframe? i don't think there are any
On Thu, Oct 8, 2009 at 10:25 AM, Robert Stehwien rstehw...@gmail.comwrote:
(defn mv2 [from to]
(let [f (if (= (class from) File) from (File. from))
t (if (= (class to) File) from (File. to))]
(println transformed to File)))
ITYM
t (if (= (class to) File) to (File.
On Thu, Oct 8, 2009 at 11:09 AM, Mark Tomko mjt0...@gmail.com wrote:
Can you give some more context?
The pesky thing about that particular error is that there IS no more
context; it fingers no specific line of code, function definition, or
whatever as culprit.
On Thu, Oct 8, 2009 at 1:06 PM, Laurent PETIT laurent.pe...@gmail.comwrote:
So I don't think you need this message-queue at all (or maybe I haven't
understood what it is or I'm mislead by its name), send directly your order
to the agent as what you want to change in its state.
You might be
On Thu, Oct 8, 2009 at 7:49 PM, John Harrop jharrop...@gmail.com wrote:
You might be able to do better than that, and dispense entirely with the
separate polling thread.
Confirmed:
(def x (agent {:polling false :message foo}))
(defn poll [m]
(when (:polling m)
(prn (:message m
On Tue, Oct 6, 2009 at 9:14 PM, Stephen C. Gilardi squee...@mac.com wrote:
`(do (set-validator! (defvar ~name ~init) #{~init}) (var ~name)))
Cute hack. Won't work if init is false or nil, though, unless the validator
does not trigger on the initial assignment of the value.
On Sun, Oct 4, 2009 at 4:41 PM, samppi rbysam...@gmail.com wrote:
I want to do this:
(defn a ...)
(cache a) ; or (cache #'a) or (cache 'a); it doesn't matter to me
...instead of this:
(def a (memoize (fn ...)))
That way, it separates the concern of what a does from the
optimization
On Mon, Oct 5, 2009 at 2:38 PM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 05.10.2009 um 19:29 schrieb cody koeninger:
Here we have the smell! You cannot define functions with a function.
You have to use a macro!
I am not clear on what you mean by this. From a user's point of view,
On Mon, Oct 5, 2009 at 11:51 AM, MarkSwanson mark.swanson...@gmail.comwrote:
On Oct 5, 2:45 am, ngocdaothanh ngocdaoth...@gmail.com wrote:
I think it is not spawn about 20K agents / second, it is 20K message
passings / second. The number is about that of Erlang.
As Clojure uses a thread
On Sat, Oct 3, 2009 at 6:50 PM, b2m b2monl...@googlemail.com wrote:
What macros do y'all have that you want to apply things to?
(defn init-funs [name levels]
(do
(apply-macro create-department-struct name levels)
(apply-macro create-process-department name levels)
nil))
A
In the specific cases of and and or, I made utility functions that do
non-short-circuiting and and or for use with apply and a stream of
boolean data. (Not sure which implementation is more efficient though: a
version that returns its argument with one argument, punts to the
appropriate macro with
On Thu, Oct 1, 2009 at 1:39 PM, Nick Day nicke...@gmail.com wrote:
Hey,
I've just been trying to run a couple of simple commands using shell-
out (e.g. (sh dir)) in a repl in Windows command prompt, but am
running up against errors of the type
java.io.IOException: Cannot run program dir:
On Thu, Oct 1, 2009 at 3:42 PM, Dragan Djuric draga...@gmail.com wrote:
I usualy cite Rich's conference paper and Stuart's book.
@conference{hickey2008clojure,
title={{The Clojure programming language}},
author={Hickey, R.},
booktitle={Proceedings of the 2008 symposium on Dynamic
On Thu, Oct 1, 2009 at 4:02 PM, Roger Gilliar ro...@gilliar.de wrote:
Am 01.10.2009 um 21:28 schrieb ngocdaothanh:
Roger, your code is not event based.
What do you mean by not event based ?
He means he wants automatic notification if a connection is dropped.
I'm not sure TCP/IP has a
On Tue, Sep 29, 2009 at 7:21 PM, David Miller dmiller2...@gmail.com wrote:
Mono:
- One BigDecimal implementation away from getting serious about
this.
Why doesn't Mono have a BigDecimal analogue? It shouldn't, in principle, be
difficult to create an open-source-friendly implementation
On Mon, Sep 28, 2009 at 5:23 AM, Jarkko Oranen chous...@gmail.com wrote:
What happens is, when you call (mfloat + 1 2) the macro evaluates ('+
(float 1) (float 2)), ie. it calls the *symbol* + with parameters 1.0
and 2.0. Symbols, when used as functions, look themselves up in
whatever
On Mon, Sep 28, 2009 at 9:20 AM, Laurent PETIT laurent.pe...@gmail.comwrote:
2009/9/28 C. Florian Ebeling florian.ebel...@gmail.com
In Java I'd just have an interface
with two implementations, and bootstrap the tests with a different
implementation, in clojure I guess I'd do something
On Sun, Sep 27, 2009 at 8:06 PM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:
On Sep 27, 12:55 am, Mark Derricutt m...@talios.com wrote:
How are people handling mocking/stubbing in clojure? Google finds me
some
old posts about a called? function/macro as part of test-is which looks
On Fri, Sep 25, 2009 at 4:49 PM, Constantine Vetoshev gepar...@gmail.comwrote:
(let [f1 #(inc %)]
(defmacro m1 [x]
`(~f1 ~x)))
(m1 12)
= No message.
[Thrown class java.lang.ExceptionInInitializerError]
The equivalent works in Common Lisp (Allegro CL and SBCL):
(let ((f1 (lambda
On Fri, Sep 25, 2009 at 8:48 PM, Constantine Vetoshev gepar...@gmail.comwrote:
On Sep 25, 6:02 pm, John Harrop jharrop...@gmail.com wrote:
I don't think you can use things like defmacro in a let.
This works:
(let [y 10]
(defmacro m1 []
`(list ~y)))
(m1) =
(10)
Well, that's
On Wed, Sep 23, 2009 at 12:29 PM, MarkSwanson mark.swanson...@gmail.comwrote:
Environment: vimclojure-2.1.2. clojure from git as of a few days ago.
Running the tests in a plain REPL from the command line worked
perfectly!
-=* THANKS GUYS !!! *=-
I wasn't expecting this at all. I thought
On Wed, Sep 23, 2009 at 1:05 PM, Fogus mefo...@gmail.com wrote:
If you're running it with JLine, then the transcript is usually stored
in ~/.jline-clojure.lang.Repl.history
Actually, that suggests a more general point: that we can have programmatic
access to the REPL's backlog if we modify
On Wed, Sep 23, 2009 at 4:18 PM, Roger Gilliar ro...@gilliar.de wrote:
I have the following code:
(defn handle-client [in out]
(binding [
*in* (reader in)
]
(with-connection db
(let [outstream (agent (writer out))]
On Wed, Sep 23, 2009 at 6:42 PM, Phil Hagelberg p...@hagelb.org wrote:
What's going on here?
The exception is being transformed. Eval and just about anything using
closures -- just about any delayed evaluation, in other words -- wraps
exceptions in RuntimeException for some reason. Even if
On Tue, Sep 22, 2009 at 6:46 PM, Eric Tschetter eched...@gmail.com wrote:
If I do just
curl 'http://localhost:43034/1.0/cloj' -H 'content-type:
application/clojure' -d '(json-str {:howdy [hi 1 2 3]})'
I get this exception
java.lang.Exception: Unable to resolve symbol: json-str in this
On Mon, Sep 21, 2009 at 2:22 PM, Richard Newman holyg...@gmail.com wrote:
But this script doesn't terminate. I have to press ctr-c to end this
script. It seems that there a still some threads active. why ?
http://www.mail-archive.com/clojure@googlegroups.com/msg13865.html
Your response
On Sat, Sep 19, 2009 at 1:07 AM, Roger Gilliar ro...@gilliar.de wrote:
Hi,
re you opening something, using it to return a lazy sequence, and
then closing it before consuming the sequence?
No. I started with just opening the database connection in the handler
function.
You mention
Nothing leaps out at me as a likely cause of a dropped message.
OTOH, the loop/recur at the end is probably better changed to a doseq.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
On Fri, Sep 18, 2009 at 8:34 AM, Mark Volkmann r.mark.volkm...@gmail.comwrote:
On Thu, Sep 17, 2009 at 5:22 PM, John Harrop jharrop...@gmail.com wrote:
On Thu, Sep 17, 2009 at 3:06 PM, Mark Volkmann
r.mark.volkm...@gmail.com
wrote:
On Thu, Sep 17, 2009 at 1:43 PM, z5h bolusm
On Fri, Sep 18, 2009 at 1:32 PM, rogergl ro...@gilliar.de wrote:
The problem is that the above code only works if I establish a
connection outside the handle-client function. Otherwise the first
reply to my client gets lost.
Has anyone an explanation for this ?
Are you opening something,
On Fri, Sep 18, 2009 at 4:39 PM, Tassilo Horn tass...@member.fsf.orgwrote:
Although that doesn't really help, the normal `reduce' doesn't do
better.
(reduce + (take 100 (iterate inc 1))) ; works
(reduce + (take 1000 (iterate inc 1))) ; OutOfMemoryError
Are you sure? I'd expect
On Fri, Sep 18, 2009 at 4:45 PM, CuppoJava patrickli_2...@hotmail.comwrote:
Hi,
After I shot myself in the foot again this morning by naming one of my
variables cond and then wondering why Clojure was complaining about
a simple cond form, I thought why don't we have capitalization
On Fri, Sep 18, 2009 at 3:52 PM, Patrik Fredriksson patri...@gmail.comwrote:
Hi!
Could someone please help me understand why the following causes a
java.lang.OutOfMemoryError: Java heap space for large n:s (10
works fine, 100 does not).
(def integers (iterate inc 1))
(defn
On Thu, Sep 17, 2009 at 11:04 AM, Mark Volkmann
r.mark.volkm...@gmail.comwrote:
On Thu, Sep 17, 2009 at 9:57 AM, Chouser chou...@gmail.com wrote:
On Thu, Sep 17, 2009 at 12:28 AM, Krukow karl.kru...@gmail.com wrote:
Final question. The docs say that 'ensure' permits more concurrency
Don't commutes commute with one another, but not with other writes?
--~--~-~--~~~---~--~~
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
On Thu, Sep 17, 2009 at 2:49 PM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:
On Sep 17, 12:40 pm, Gorsal s...@tewebs.com wrote:
Oh. And just as a quick other question, do global bindings affect
threads which are started in the same ns?
I think threads inherit the bindings in effect
On Thu, Sep 17, 2009 at 6:15 PM, Gorsal s...@tewebs.com wrote:
Or maybe i could simply push to the global var and in addition to the
value use a unique gensymed id. Then once the local binding was done
it would pop until it sees its gensymed id. That would work in the
situation that a local
On Tue, Sep 8, 2009 at 8:18 PM, Timothy Pratley timothyprat...@gmail.comwrote:
Hi Steve,
I find the -1, 0, 1 result more useful, but am also wary it hides some
useful information. My preference would be to have the doc-string
changed to what you proposed and keep the neg/pos behaviour
of
Or, you can go the opposite way and write a macro that expands into the
appropriate ns form. This will work if the information you need from
*db-adapter* is there by macroexpansion time.
A macro that does a similar job to ns, but adds conditional features to the
ns DSL, can wrap and generalize
On Mon, Sep 7, 2009 at 5:19 PM, Conrad drc...@gmail.com wrote:
Alternatively, I suppose it would be possible to create a new type of
map that performs better than an alist but can return items in the
order they were added to the list, if desired
Or use an existing type: the
Besides using just aset, try using unchecked-inc instead of inc.
--~--~-~--~~~---~--~~
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
Try unchecked-inc and try wrapping the function body in (let [words (int
words)] ... ).
I don't know why aset is still reflecting when all of the arguments are
type-hinted, but the above changes might speed up some other bits of the
code.
--~--~-~--~~~---~--~~
You
On Wed, Sep 2, 2009 at 1:02 PM, tmountain tinymount...@gmail.com wrote:
Hi all - I've recently encouraged a friend to start learning Clojure,
and he has written some basic Markov chaining code as a learning
exercise. His code works fine with small sets of input data, but
larger inputs have
On Tue, Sep 1, 2009 at 10:40 AM, Rich Hickey richhic...@gmail.com wrote:
On Mon, Aug 31, 2009 at 10:55 AM, Krukowkarl.kru...@gmail.com wrote:
I have two minor minor suggestions for Clojure changes.
1) Consider this function:
user (set! *warn-on-reflection* true)
true
user (defn
On Mon, Aug 31, 2009 at 5:15 PM, Brian Hurt bhur...@gmail.com wrote:
If I recall correctly (and correct me if I'm wrong), Python uses a
reference counting garbage collector. Which means as soon as the reference
to the object goes away, the object gets collected and the handle closed.
Most
On Mon, Aug 31, 2009 at 5:04 PM, Brian Hurt bhur...@gmail.com wrote:
On Sun, Aug 30, 2009 at 9:31 AM, Jason Baker amnorv...@gmail.com wrote:
On Aug 30, 2:24 am, Dan Fichter daniel.fich...@gmail.com wrote:
The Clojure version is more concise and radically safer but a little
more
On Mon, Aug 31, 2009 at 3:45 PM, freddi301 gobi...@gmail.com wrote:
are there a complete clojure documentation ?
There's the documentation at clojure.org; you could spider it with wget,
though with some sites you need to spoof the user-agent and/or hack wget to
disable retrieving robots.txt
On Sun, Aug 30, 2009 at 7:57 AM, Jan Rychter j...@rychter.com wrote:
Tassilo Horn tass...@member.fsf.org writes:
[...]
BTW: What's the reason that Clojure is licensed under the EPL and the
contrib stuff under CPL? Since clojure is not really eclipse-related, I
don't see a good
On Sun, Aug 30, 2009 at 10:40 AM, Jason Baker amnorv...@gmail.com wrote:
I've written a test that does this:
public void ReadFile(TextReader infile)
{
using (var text_reader = new PushbackTextReader(infile)) {
LispReader.read(text_reader, false,
On Sun, Aug 30, 2009 at 4:14 PM, kyle smith the1physic...@gmail.com wrote:
I wrote this based on assoc-in. If anyone thinks this should be in
core or contrib, feel free to use it.
(defn assoc-in-by
'Updates' a value in a nested associative structure, where ks is a
sequence of keys and
This is a problem.
The GPL is a very popular open source license. If a language does not permit
developers to use the GPL, that language may be severely reducing the number
of developers willing to adopt it.
It would be desirable for clojure.lang and clojure.core to use a modified
license,
On Sat, Aug 29, 2009 at 12:00 PM, Rich Hickey richhic...@gmail.com wrote:
This has been discussed as nauseam before:
http://groups.google.com/group/clojure/browse_frm/thread/6e99caafcf2bbedf/b5519cc219a5baeb
Nothing has changed, so let's give it a rest, please.
This may be a tempest in a
On Fri, Aug 28, 2009 at 4:45 AM, peter veentjer alarmnum...@gmail.comwrote:
Clojure's STM is part of a holistic language design where
people will normally be programming with immutable persistent
composite data structures. Getting a consistent view of such a data
structure doesn't require
On Fri, Aug 28, 2009 at 8:50 AM, Rich Hickey richhic...@gmail.com wrote:
On Thu, Aug 27, 2009 at 8:10 PM, Tim Snydertsnyder...@gmail.com wrote:
Well, I can see that LazySeq does indeed catch and wrap all Exceptions
in a RuntimeException. I also think I can work around it, but I'd
like
On Thu, Aug 27, 2009 at 3:35 PM, Howard Lewis Ship hls...@gmail.com wrote:
Is the order of keys in a map predictable? I have some tests I'm
concerned about, where the keys and values in a map are converted to a
string (ultimately, a URL, as query parameters) and the order will
affect the
On Tue, Aug 25, 2009 at 11:42 AM, Chouser chou...@gmail.com wrote:
On Tue, Aug 25, 2009 at 10:36 AM, John Harropjharrop...@gmail.com wrote:
What the hell?
The group actually gets a steady stream of spam, but it
usually gets deleted instead of being sent to everyone. On
this one I
On Wed, Aug 26, 2009 at 1:13 PM, John Harrop jharrop...@gmail.com wrote:
This is important to know about for security reasons, also. Specifically,
if you are receiving Clojure data structures in text form over the network,
and don't set *read-eval* to false, you're vulnerable to a Clojure
This is important to know about for security reasons, also. Specifically, if
you are receiving Clojure data structures in text form over the network, and
don't set *read-eval* to false, you're vulnerable to a Clojure injection
attack. Someone could send you (+ 5 #=(System/exit 0)) as a
What the hell?
--~--~-~--~~~---~--~~
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
On Tue, Aug 25, 2009 at 10:42 AM, Fogus mefo...@gmail.com wrote:
A quick and dirty way would be to use a map as your intermediate
storage with your generated numbers as keys and some constant as their
assoc'd value. Once you've populated said map with the proper number
of entries (keeping
On Wed, Aug 19, 2009 at 10:03 AM, Achim Passen achim.pas...@gmail.comwrote:
Beware! This snippet relies on unexposed details of clojure's current
implementation. It might stop working tomorrow, so it's definitely not
intended for production use, but it might help with debbuging/exploring.
(def *dosync-counts* (atom {})
(defn avg-in [map key val]
(let [[avg cnt] (get map key [0 0])]
(assoc map key [(/ (+ (* avg cnt) val) (inc cnt)) (inc cnt)])))
(defmacro logged-dosync [ body]
`(let [count# (atom 0)]
(dosync
(swap! count# inc)
~...@body)
(swap!
On Thu, Aug 20, 2009 at 12:45 AM, samppi rbysam...@gmail.com wrote:
For me, I'd like it if the core functions had the data as the first
argument, but have a special function—I can't come up with a better
name than partial-2—so that (partial-2 function opt1 opt2 opt3) is
equivalent to (fn
On Mon, Aug 17, 2009 at 11:35 PM, Mark Triggs mark.h.tri...@gmail.comwrote:
Thanks all. So combining a few suggested ideas:
(defn slice
Return the items in coll at index positions keys.
(slice [0 4 6] \abcdefg\) = (\\a \\e \\g)
[keys coll]
(let [max-idx (apply max keys)
On Sun, Aug 16, 2009 at 1:30 AM, botgerry botge...@gmail.com wrote:
Hello,all
new to functional programming, I have one nested dynamic vecter just
like this:
(def a [[1 2 3 4] [ok 89 22] [25 78 99] ...]]
it has to support ops:
1* add new item,it's easy: eg. (conj a [metoo oops] )
On Fri, Aug 14, 2009 at 7:18 PM, bradford cross
bradford.n.cr...@gmail.comwrote:
Hi Chad, yep, that was me. We do hope to open source some stuff soon.
First will probably be our wrappers for cascading/hadoop and s3.
Next might be some core language extensions which might be good in contrib
On Wed, Aug 12, 2009 at 5:25 AM, Piyush Ranjan piyush...@gmail.com wrote:
This is a troll question. I have seen similar questions posted on other
forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran,
bigloo(?) etc by the same poster.
Hmm. fft1976 = WrexSoul?
On Thu, Aug 13, 2009 at 12:34 AM, Richard Newman holyg...@gmail.com wrote:
This is the difference between 'conventional' and point-free style, by
the way. Many people view point-free as being somehow more elegant,
and I'm generally inclined to agree... apart from in cases like your
example,
On Tue, Aug 11, 2009 at 6:39 AM, Krukow karl.kru...@gmail.com wrote:
I was browsing through core when I noticed something I didn't
understand in 'into' (from core.clj):
;redef into with batch support
(defn into
Returns a new coll consisting of to-coll with all of the items of
from-coll
On Mon, Aug 10, 2009 at 10:57 PM, Kyle R. Burton kyle.bur...@gmail.comwrote:
On Mon, Aug 10, 2009 at 10:42 PM, Kyle R. Burtonkyle.bur...@gmail.com
wrote:Sorry, forgot to offer up the inverse of freeze, thaw:
(defn thaw [bytes]
(with-open [bais (java.io.ByteArrayInputStream. bytes)
On Tue, Aug 11, 2009 at 12:17 AM, fft1976 fft1...@gmail.com wrote:
I don't know JVM too well, but I think no efficient user-level
solution is possible. Why? To take care of substructure sharing, you
need to remember a set of shareable values that have already been
serialized, and do reference
On Fri, Aug 7, 2009 at 8:14 PM, John Harrop jharrop...@gmail.com wrote:
Your core loop seems to be:
(loop [zr (double 0.0)
zi (double 0.0)
zr2 (double 0.0)
zi2 (double 0.0)
iterations-remaining iterations-remaining]
(if (and (not (neg? iterations
On Sun, Aug 9, 2009 at 8:55 PM, David Nolen dnolen.li...@gmail.com wrote:
Sounds like you want apply:
(apply fn args)
Indeed.
Since create-struct (not create-structure!) is a function, this should work.
It wouldn't work with a macro, though.
On Sun, Aug 9, 2009 at 12:47 PM, Lauri Pesonen lauri.peso...@iki.fi wrote:
2009/8/8 Luc Prefontaine lprefonta...@softaddicts.ca:
I totally agree no comments is not good at all but JavaDoc style comments
in
Clojure ? I pray you all, please stay away of it :
I was quite taken by this
On Sun, Aug 9, 2009 at 3:06 AM, Andy Fingerhut
andy_finger...@alum.wustl.edu wrote:
I did two runs for each version, with the only difference between them
being replacing the (zero? i) expression in function 'dot' with a
different expression, as indicated below. (zero? i) is a clear winner
On Fri, Aug 7, 2009 at 9:19 PM, Andy Fingerhut
andy_finger...@alum.wustl.edu wrote:
What I suggest is
(loop [zr (double 0.0)
zi (double 0.0)
i (int (inc iterations-remaining))]
(let [zr2 (* zr zr)
zi2 (* zi zi)]
(if (and (not (= 0 i)) ( (+ zr2 zi2
On Sat, Aug 8, 2009 at 2:50 AM, cody koeninger c...@koeninger.org wrote:
Assuming people aren't patching clojure ala dave griffith's external
transactions patch in the group files, what are people doing in
practice to durably store the state of refs?
Storing within a transaction and somehow
On Sat, Aug 8, 2009 at 5:23 AM, Mark Engelberg mark.engelb...@gmail.comwrote:
On Fri, Aug 7, 2009 at 5:14 PM, John Harropjharrop...@gmail.com wrote:
(if (and (not (= 0 i)) ( (+ zr2 zi2 limit-square)))
I believe that (zero? i) is faster than (= 0 i).
On primitive ints? Have you tested
On Thu, Aug 6, 2009 at 6:57 PM, Andy Fingerhut
andy_finger...@alum.wustl.edu wrote:
You are correct. I've updated that file:
http://github.com/jafingerhut/clojure-benchmarks/blob/bb9755bdeeccae84a9b09fbf34e45f6d45d4b627/RESULTS
Could you post the Mandelbrot code you use? Because I know
Your core loop seems to be:
(loop [zr (double 0.0)
zi (double 0.0)
zr2 (double 0.0)
zi2 (double 0.0)
iterations-remaining iterations-remaining]
(if (and (not (neg? iterations-remaining))
( (+ zr2 zi2) limit-square))
(let [new-zi (double (+
On Tue, Aug 4, 2009 at 5:50 PM, Rich Hickey richhic...@gmail.com wrote:
On Aug 4, 4:31 pm, John Harrop jharrop...@gmail.com wrote:
What about things like:
(persistent!
(reduce
(fn [x [i v]] (assoc! x i v))
(transient (vec (repeat 0 (reduce max (map first
coll-of-index-val
On Tue, Aug 4, 2009 at 7:46 PM, Vagif Verdi vagif.ve...@gmail.com wrote:
When reflection warning is on, i get 2 warnings on every my file:
reference to field getClass can't be resolved.
That one is very weird, because getClass is a method of java.lang.Object. It
should always be possible to
I just saw someone post a bunch of Clojure code to comp.lang.lisp one
function from which was:
(defn partition-with [pred coll]
(loop [in coll curr [] out []]
(if (empty? in)
(conj out curr)
(let [obj (first in)]
(if (pred obj)
(recur (rest in) [] (conj out
Very clever, 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
On Tue, Aug 4, 2009 at 2:22 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
On Aug 3, 10:10 pm, John Harrop jharrop...@gmail.com wrote:
(defn and-ns
A non-short-circuiting \and\ usable in reduce etc.
([] true)
([a] a)
([a b] (and a b))
([a b more] (reduce and-ns
On Mon, Aug 3, 2009 at 4:16 AM, Adie adit...@gmail.com wrote:
Good Afternoon folks,
I am a newbie to Clojure, coming from CL, with very little Java
background.
I am trying to use the 'javax.persistence' libraries, but i just cant
seem to import it properly
for e.g
(import
On Mon, Aug 3, 2009 at 8:53 AM, Mike DeLaurentis delauren...@gmail.comwrote:
I believe it stands for member function. From the doc string:
Expands into code that creates a fn that expects to be passed an
object and any args and calls the named instance method on the
object passing the
On Mon, Aug 3, 2009 at 3:45 PM, Richard Newman holyg...@gmail.com wrote:
user= (macroexpand-1 '(memfn add x y))
(clojure.core/fn [target__4193__auto__ x y] (. target__4193__auto__
(add x y)))
That is, basically (fn [object x y] (.add object x y)).
.add is macroexpanded into the more
On Mon, Aug 3, 2009 at 5:43 PM, samppi rbysam...@gmail.com wrote:
I'm getting stuck because a-map always gets passed into my-macro
as a symbol.
(defmacro my-macro [a-map forms] ; Naive implementation
`(binding ~(vec (process-a-map a-map)) ~...@forms))
Try
(defmacro my-macro [a-map
On Mon, Aug 3, 2009 at 7:27 PM, CuppoJava patrickli_2...@hotmail.comwrote:
Hi Rich,
This is a very useful addition thanks. I personally find the O(1)
transformation to and back most useful.
I have a question about capturing the return values of conj! and
assoc!.
in this code:
(let [v
On Mon, Aug 3, 2009 at 8:01 PM, CuppoJava patrickli_2...@hotmail.comwrote:
You can use eval to retrieve the value of a-map when the macro is
expanded.
(let [value (eval a-map)]
`(binding ~(vec (process-a-map value)) ~...@forms))
I've programmed some substantial programs now in Clojure
On Thu, Jul 30, 2009 at 9:37 PM, Richard Newman holyg...@gmail.com wrote:
I suppose in Clojure we could use a real arrow character, with UTF-8
available in symbol names...
I don't know about you, but I personally prefer to only use symbols that I
can actually type. Copying and pasting from
user= (definline addsq [a b] `(+ (* ~a ~a) (* ~b ~b)))
#'hxr.clj.util/addsq
user= (addsq (do (println a evaluated) 1) 1)
a evaluated
a evaluated
2
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post
On Wed, Jul 29, 2009 at 2:59 AM, Daniel Lyons fus...@storytotell.orgwrote:
Probably it would help to try and implement a lazy
list of the Fibonacci sequence before looking at that code, and then
maybe try some other mathematical sequences that are a little easier
to construct too.
Using the
On Mon, Jul 27, 2009 at 8:33 PM, nchubrich nicholas.chubr...@gmail.comwrote:
Anyway I'd appreciate any critiques of the implementation; whether
it's a useful thing or not; if there are more idiomatic ways of doing
the same thing; and, if yes-no to the aforetwo, where's the best place
to add
On Mon, Jul 27, 2009 at 9:00 PM, Rayne disciplera...@gmail.com wrote:
I've googled around, and found several ways to do this in Java, but
I've not been successful in translating the less-complex examples. I'm
wondering, how would an experienced Clojurian go about doing this in
Clojure?
On
On Mon, Jul 27, 2009 at 3:37 PM, Mark Addleman mark_addle...@bigfoot.comwrote:
I have written some Clojure code to implement java.lang.CharSequence
that is constructed with a length and an ISeq of strings. I need this
because I want to pass the resulting CharSequence into Java's regex
201 - 300 of 332 matches
Mail list logo