Hi,
I Midje test functions that log. I want to disable logging during testing.
What's the easiest way to do that? I saw a message by Sean Corfield from
a year and a half ago about altering the *logger-factory* root to ensure a
particular logger implementation is chosen project wide. Obvious
N/m, this is a known issue. http://dev.clojure.org/jira/browse/CLJ-84
On Jan 8, 11:23 am, Alyssa Kwan wrote:
> Hi everyone!
>
> I'm having trouble getting the following to compile from "lein
> compile":
>
> (ns foo.Bar
> (:gen-class
> :methods [[chai
Hi everyone!
I'm having trouble getting the following to compile from "lein
compile":
(ns foo.Bar
(:gen-class
:methods [[chain [] foo.Bar]]))
(defn -chain [this]
this)
My project.clj has foo.Bar declared as a :namespace.
Perhaps I'm not understanding the compile error. Is there a way t
Generating readable code for IDEs is not a good reason. You should
think carefully about variable capture and decide which you want.
Usually, in a macro-generated defn, I do want to capture the
parameters, so I would use ~'this.
On Dec 30, 11:54 pm, André Thieme wrote:
> Am 31.12.2010 03:29, schr
Argh! Six minutes! :P
On Dec 30, 9:42 pm, Alyssa Kwan wrote:
> Technically, there's no possibility of variable capture, but you
> should use gensyms:
>
> (defmacro defrecord-ifn [name & args]
> `(defrecord ~name ~...@args
> clojure.lang.IFn
> (invo
Technically, there's no possibility of variable capture, but you
should use gensyms:
(defmacro defrecord-ifn [name & args]
`(defrecord ~name ~...@args
clojure.lang.IFn
(invoke [this# key#] (get this# key#
Thanks,
Alyssa
On Dec 30, 9:29 pm, Alex Baranosky
wrote:
> I've been playi
Hi!
You would be more than welcome at the Boston Coding Dojo (http://
www.meetup.com/boston-coding-dojo/). We meet every other Thursday at
First Church in Boston, in Boston's Back Bay on Marlborough St. In
January, we are meeting on 1/6 and 1/20, so nothing on the week of
1/9, I'm afraid. What
I completely disagree. If arbitrary load order were sufficient, there
wouldn't be (prefer-method). (And CL wouldn't have a complex
heuristic for ordering.) In reality, you may be extending someone
else's library by calling (defmethod) on their (defmulti). And you
could be using someone else's l
ck wrote:
> On Dec 22, 2010, at 6:52 AM, Alyssa Kwan wrote:
>
> > The issue is where do I specify that:
> > (undo-fn ...patch...) => (fn [] (reset! visible-evidence-of-a-side-
> > effect :happened!))
>
> The code you quoted is that specification. It doesn't mat
The issue is where do I specify that:
(undo-fn ...patch...) => (fn [] (reset! visible-evidence-of-a-side-
effect :happened!))
undo-fn is a multimethod in my design, which requires a corresponding
defmethod for each patch type. I need to create one for the scope of
the test, but defmethod by defin
I'd like to discuss this design approach. (It's unrelated to the
testing issue.) I avoided this design because the undo-fn is
determined at do-patch! time. The use case is for a persistent system
like Git where patches may be undone long after being done - e.g. long
after the patch is written to
Hi Alex,
Unfortunately the some-fn has to be created at the top level; it has
to be a var to be dynamically bindable, and Midje (and AFAIK, all
other mocking frameworks) use dynamic binding.
Here's what I came up with, using clojure.contrib.mock.test-adapter:
(deftest test-undo-patch!-calls-undo
Hi everyone,
Does anyone have any experience in mocking multimethods? I'm working
on a version control framework modeled after Git:
(def
^{:private true}
patches- (ref [])
(defn patches []
(seq @patches-))
(defn do-patch! [fn & args]
(dosync
(apply fn args)
(let [patch {:fn fn
Awesome!!! This absolutely does the trick!
On Dec 21, 7:16 pm, Phil Hagelberg wrote:
> On Dec 21, 10:35 am, Alyssa Kwan wrote:
>
> > What about when I need to delete a unit test? Reloading the test
> > buffer doesn't remove it, and I need to either restart swank or
Hi everyone,
My typical development workflow is to use leiningen to create a
project stub, modify project.clj to add swank-clojure as a dev-
dependency, and run lein-swank and connect from Emacs slime. As I
create and modify files in the test and src namespaces/directory
structures, I use C-c C-k
ay nomenclature only muddies the water.
On Dec 20, 1:41 pm, Ken Wesson wrote:
> On Mon, Dec 20, 2010 at 1:30 PM, Alyssa Kwan wrote:
> > No, identifiers are names. Identity transcends names. For example,
> > in a distributed shared object system, multiple machines on the same
> >
I hadn't considered using an online validator. Given that these are
only unit tests, this is the simplest solution. Thanks!
On Dec 18, 7:27 pm, Jeff Valk wrote:
> On Saturday, December 18, 2010 at 02:10 pm, Alyssa Kwan wrote:
>
> > I'd like to unit test my html outp
No, identifiers are names. Identity transcends names. For example,
in a distributed shared object system, multiple machines on the same
network will have different identifiers for the same identity.
"Ordinary usage" isn't good enough for metaphysical discussions.
There is a metaphysical discussi
Hi!
I'd like to unit test my html output for well-formedness. What's an
easy way to test it for HTML5 validity? Are there good Clojure libs
for this? I only need to check for validity, not parse.
Thanks!
Alyssa
--
You received this message because you are subscribed to the Google
Groups "Clo
Incidental mutability is the key. Functional programming doesn't
eliminate mutability, it manages it: only the parts of the system
that truly need to change state do so. Everything else is pure and
easy to write and test. Contrast that with imperative programming
where it's hard to tell which s
Yes, but why isn't persistence of closures generating more
interest. ;)
Persistence is "solved", if you're OK with not being truly ACID...
Seriously though, everyone has their own backends. I don't think
anyone wants to be tied to BDB JE.
Would there be interest in lazy-loading and -unloading
+1
There is no STM integration with atoms. That's not a concern.
Just write your own Clojure core with your change. I did for durable
identities. git://github.com/kwanalyssa/clojure.git
Seriously though, just use protocols.
Thanks,
Alyssa
On Dec 6, 5:24 am, Benjamin Teuber wrote:
> I guess
+1
Lazy is better.
Personally, I would have used filter and map instead of for, but this
is probably clearer.
Thanks,
Alyssa
On Dec 6, 10:30 am, Justin Kramer wrote:
> tree-seq makes this pretty simple:
>
> (defn nested-vals [key coll]
> (for [x (tree-seq coll? seq coll) :when (contains? x k
Hi Mike,
"TDD as if you meant it" -
http://gojko.net/2009/02/27/thought-provoking-tdd-exercise-at-the-software-craftsmanship-conference/
What you want is mocking and stubbing (these are different things!).
http://s-expressions.com/2010/01/24/conjure-simple-mocking-and-stubbing-for-clojure-unit-te
IMHO, any built-in string compare should support collations. I think
this belongs in contrib in string.
On Nov 29, 2:59 am, Tim Robinson wrote:
> why not change > < type compare functions do a compare on strings as
> well?
>
> (defn >
> ([x] true)
> ([x y](if (string? x)
> (
is also welcome.
Thanks!
Alyssa Kwan
--
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 un
On Nov 18, 1:49 am, Alex Osborne wrote:
> Hi Alyssa,
>
> I don't think this situation is possible because Namespace.mapping
> (which maps symbols to vars and classes) is *not* thread-local. For a
> given namespace and symbol all threads will resolve the same var object.
>
> It's the binding of th
On Nov 17, 10:35 pm, Ken Wesson wrote:
> On Wed, Nov 17, 2010 at 9:57 PM, Alyssa Kwan wrote:
>
> How are you planning to persist a function? The clojure reader can't
> read functions output with spit or println.
I'm not persisting functions at compile time. fns are firs
how do you reconcile that there are
multiple refs being stored under the same store/key? That's
untenable, but it seems totally arbitrary to simply say that the first
thread that gets there determines which var the function is bound to
for the duration of the JVM instance.
What do you think?
Thanks everyone!
Alyssa Kwan
On Nov 17, 11:10 am, Stuart Halloway
wrote:
> I am wrong, there was a bug here, and Rich just fixed it.
>
> https://github.com/clojure/clojure/commit/8225407032ea643cbe3db7f35ef...
>
> Please retry against master, and sorry for inflicting more con
The issue here is not with b pointing to a. It's that b should point
to b but doesn't. This *can't* be seen to be correct.
Thanks,
Alyssa Kwan
On Nov 17, 9:22 am, Stuart Halloway wrote:
> In 1.2, functions were always looked up through their vars. While this is a
> low-co
terribly unsupported as well.
I guess the question is: what do other people expect? Am I alone in
thinking that this is unexpected and undesirable?
Thanks,
Alyssa Kwan
On Nov 17, 3:04 am, Alex Osborne wrote:
> Hi Alyssa,
>
> Alyssa Kwan writes:
> > ns-unmap isn't typi
rm doesn't work anymore, so there's
no way to dynamically bind over it. It's like a weird hybrid of
lexical and dynamic binding...
Thanks,
Alyssa Kwan
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, se
d, as David Sletten points out,
which I agree is the correct behavior. But something has happened on
1.3 alpha that has changed that. I don't know if it's intentional or
not.
Thanks,
Alyssa Kwan
On Nov 16, 6:01 pm, David Nolen wrote:
> But that would destroy one of the most useful fe
his what people expect? I would think that the original
definition of a, which is self-referencing, should point to itself no
matter what it's named, not get resolved at invoke-time to see what
the var is currently resolving to.
Thanks,
Alyssa Kwan
--
You received this message because you a
; > On Nov 15, 12:12 pm, Alyssa Kwan wrote:
> >> In your example, my-generator isn't the concern. It's the call to my-
> >> generator that creates functions, each of which creates bytecode, is
> >> loaded as a class, then is instantiated, and finally invoked.
If you look at the bytecode for the closures, you'll see that the Var
that *ns*/a points to is resolved at time, and the Java
reference is stored as a static final class member. That's a small
use of additional permgen.
In your example, my-generator isn't the concern. It's the call to my-
gener
I'm building an ETL app, so aggregate functions of arbitrarily large
arity is a necessity. I've had to wrap a lot of core clojure
functions with concrete arg lists to make them work with lazy
sequences. In my limited experience, machine generated code of this
nature should use lazy sequences that
Performance is part of it too. Allowing dispatch on arity leads to
faster code.
Many of the functions that operate on sequences are lazy so dispatch
on arity doesn't apply.
On Nov 15, 11:52 am, Chris wrote:
> If you have a function that needs to treat multiple arguments as a
> group, what force
REALLY welcome!
Feedback appreciated and patches welcome!
Alyssa Kwan
--
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
On Oct 15, 7:57 pm, peter veentjer wrote:
> On Oct 15, 2:51 pm, hobnob wrote:
>
>
>
>
>
> > Hi,
>
> > I'm just starting to get my head wrapped around STM just by reading
> > about it so I can make a decision on whether to port a Java project to
> > Clojure.
>
> > a) can STM transactions contain
f STM identities.
git://github.com/kwanalyssa/clojure.git
Thanks!
Alyssa
On Oct 3, 12:54 am, Alyssa Kwan wrote:
> I've noticed a bug in my implementation of the durable ref, or "dref"
> construct.
--
You received this message because you are subscribed to the Google
Groups "
I've noticed a bug in my implementation of the durable ref, or "dref"
construct. This is an attempt to add durability to the STM. drefs
have all of the ACI guarantees of refs, with the additional property
of being durable, so changes to the state of the identity are
durable. The API is that ther
ve and add a prepare
phase to the STM.
On Sep 23, 11:05 pm, Per Vognsen wrote:
> On Thu, Sep 23, 2010 at 8:16 PM, Alyssa Kwan wrote:
> > There's no need for any transaction boundary; you just
> > have to make sure that compareAndSet does a durable swap.
>
> I had
I haven't benchmarked... I don't have much experience with
benchmarking. Assistance would be greatly appreciated!
On Sep 23, 9:09 pm, Dragan Djuric wrote:
> What is the performance penalty?
>
> On Sep 23, 5:21 am, Alyssa Kwan wrote:
>
>
>
> >
> were mutated during the transaction so as to flag them dirty for
> write-back or write-through caching; this is why we need the pref back
> reference in the metadata.
>
> Anyway, even assuming this all works, it will obviously be less
> computationally efficient than extendin
atterns. Let me know!
Please dig in! Feedback appreciated!
Alyssa Kwan
--
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 pat
Thanks, Constantine! Your work on cupboard is awesome! I'll take a
look at the deadlock detection to see if I can help.
Any thoughts on how to marshal functions? What about vars and dynamic
binding?
Thanks!
Alyssa
On Sep 5, 11:02 am, Constantine Vetoshev wrote:
> On Aug 30, 5:02 pm, nchubrich
> > How about introducing a second part to the api? (store) creates a
> > wrapper for the persistent address, and refp then takes one of those
> > wrappers and the name?
>
> I like that. I would go one step further and say refp should have a
> default data store that is used unless you specify any
short-circuit the commutes loop, and what if there
is a read lock on a member of the sets set?
Everything is done with the exception of the actual compare and set
operation with the BDB database. In other words, the real work. :)
Thanks!
Alyssa
On Sep 1, 6:14 pm, Alyssa Kwan wrote:
> I'l
ITA. I was planning on doing what clojure.contrib.sql does with a
global var and with-connection block for dynamic binding. Unless
people don't like that approach...
On Sep 2, 12:56 pm, Mike Meyer wrote:
> On Wed, 1 Sep 2010 15:14:45 -0700 (PDT)
>
>
>
>
>
> Alyssa Kw
Revision number is a great idea!
I don't think I want to do copy-on-write within Clojure because it
would require a separate thread for cleanup. The underlying database
should take care of it anyways.
Thanks!
Alyssa
On Sep 2, 8:47 am, Timothy Baldridge wrote:
> >It checks the value against memo
I'll go one step further and say that we shouldn't have to call
"persist namespace". It should be automatic such that a change to the
state of an identity is transactionally written.
Let's start with refs. We can tackle the other identities later.
The API is simple. Call (refp) instead of (ref
I'm resurrecting this thread from quite a while ago... I'm very
interested in being able to ensure that the state of a ref is
persisted as part of the same transaction that updates the ref.
Performance is not important; correctness is. Has any further work
been done on this front?
http://groups.
This is definitely flamebait. However, he has a point. Perhaps we
should make it clear on the Getting Started page that deploying Java
is a prerequisite to deploying Clojure, and include links to resources
on how to do that for the platform you are on. It's presently unclear
to anyone without a
55 matches
Mail list logo