Re: Why I have chosen not to employ clojure

2010-03-22 Thread Alyssa Kwan
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

[tools.logging] Adding Null Logger Impl and Forcing It For Testing

2013-04-24 Thread Alyssa Kwan
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.

Re: Get sequence of values in arbitrarily nested collection

2010-12-06 Thread Alyssa Kwan
+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 jkkra...@gmail.com wrote: tree-seq makes this pretty simple: (defn nested-vals [key coll]   (for [x (tree-seq coll? seq coll) :when

Re: There is no such thing as IAtom

2010-12-06 Thread Alyssa Kwan
+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. shamelessPluggit://github.com/kwanalyssa/clojure.git/ shamelessPlug Seriously though, just use protocols. Thanks, Alyssa On Dec 6, 5:24 am,

Re: ANN: Durable Clojure - Functions and Closures

2010-12-06 Thread Alyssa Kwan
Yes, but why isn't persistence of emclosures/em 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

Re: Lots of newbie clojure questions

2010-12-07 Thread Alyssa Kwan
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

HTML5 Validator

2010-12-18 Thread Alyssa Kwan
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

Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Alyssa Kwan
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

Re: HTML5 Validator

2010-12-20 Thread Alyssa Kwan
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 jv-li...@tx.rr.com wrote: On Saturday, December 18, 2010 at 02:10 pm, Alyssa Kwan wrote: I'd like to unit test my html output for well

Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Alyssa Kwan
the water. On Dec 20, 1:41 pm, Ken Wesson kwess...@gmail.com wrote: On Mon, Dec 20, 2010 at 1:30 PM, Alyssa Kwan alyssa.c.k...@gmail.com wrote: No, identifiers are names.  Identity transcends names.  For example, in a distributed shared object system, multiple machines on the same network

Automatically unmapping unit tests from namespaces

2010-12-21 Thread Alyssa Kwan
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

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Alyssa Kwan
Awesome!!! This absolutely does the trick! On Dec 21, 7:16 pm, Phil Hagelberg p...@hagelb.org wrote: On Dec 21, 10:35 am, Alyssa Kwan alyssa.c.k...@gmail.com 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

Mocking multimethods

2010-12-21 Thread Alyssa Kwan
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

Re: Mocking multimethods

2010-12-22 Thread Alyssa Kwan
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

Re: Mocking multimethods

2010-12-22 Thread Alyssa Kwan
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

Re: Mocking multimethods

2010-12-22 Thread Alyssa Kwan
...@exampler.com 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 matter that undo-fn is a multimethod. Here's

Re: dispatching on a resulting range

2010-12-23 Thread Alyssa Kwan
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

Re: Boston meetup Jan 11?

2010-12-30 Thread Alyssa Kwan
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

Re: an object of class created using defrecord does not implement IFn .. while it behaves very similar to map otherwise ..

2010-12-30 Thread Alyssa Kwan
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

Re: an object of class created using defrecord does not implement IFn .. while it behaves very similar to map otherwise ..

2010-12-31 Thread Alyssa Kwan
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 splendidl...@googlemail.com wrote:

gen-class for methods returning own class for chained calls

2011-01-08 Thread Alyssa Kwan
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 to

Re: gen-class for methods returning own class for chained calls

2011-01-08 Thread Alyssa Kwan
N/m, this is a known issue. http://dev.clojure.org/jira/browse/CLJ-84 On Jan 8, 11:23 am, Alyssa Kwan alyssa.c.k...@gmail.com wrote: Hi everyone! I'm having trouble getting the following to compile from lein compile: (ns foo.Bar   (:gen-class    :methods [[chain [] foo.Bar]])) (defn

Re: Extending Clojure's STM with external transactions

2010-08-29 Thread Alyssa Kwan
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?

Re: Extending Clojure's STM with external transactions

2010-09-02 Thread Alyssa Kwan
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)

Re: Extending Clojure's STM with external transactions

2010-09-03 Thread Alyssa Kwan
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 tbaldri...@gmail.com wrote: It checks the

Re: Extending Clojure's STM with external transactions

2010-09-03 Thread Alyssa Kwan
) Alyssa Kwan alyssa.c.k...@gmail.com wrote: 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

Re: Extending Clojure's STM with external transactions

2010-09-05 Thread Alyssa Kwan
-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 alyssa.c.k...@gmail.com wrote

Re: Extending Clojure's STM with external transactions

2010-09-05 Thread Alyssa Kwan
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 anything

Re: Extending Clojure's STM with external transactions

2010-09-05 Thread Alyssa Kwan
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 gepar...@gmail.com wrote: On Aug 30,

ANN: Durable refs with ACID guarantees - Phase I

2010-09-23 Thread Alyssa Kwan
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 patient with your first post. To unsubscribe from

Re: ANN: Durable refs with ACID guarantees - Phase I

2010-09-23 Thread Alyssa Kwan
the pref back reference in the metadata. Anyway, even assuming this all works, it will obviously be less computationally efficient than extending LockingTransaction.java with special support. -Per On Thu, Sep 23, 2010 at 10:21 AM, Alyssa Kwan alyssa.c.k...@gmail.com wrote

Re: ANN: Durable refs with ACID guarantees - Phase I

2010-09-23 Thread Alyssa Kwan
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 draga...@gmail.com wrote: What is the performance penalty? On Sep 23, 5:21 am, Alyssa Kwan alyssa.c.k...@gmail.com wrote

Re: ANN: Durable refs with ACID guarantees - Phase I

2010-09-23 Thread Alyssa Kwan
phase to the STM. On Sep 23, 11:05 pm, Per Vognsen per.vogn...@gmail.com wrote: On Thu, Sep 23, 2010 at 8:16 PM, Alyssa Kwan alyssa.c.k...@gmail.com wrote: There's no need for any transaction boundary; you just have to make sure that compareAndSet does a durable swap. I had the chance to read

Help Fixing Bug in Durable Reference Creation Inside DoSync Transaction

2010-10-02 Thread Alyssa Kwan
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 there

Re: Help Fixing Bug in Durable Reference Creation Inside DoSync Transaction

2010-10-03 Thread Alyssa Kwan
identities. git://github.com/kwanalyssa/clojure.git Thanks! Alyssa On Oct 3, 12:54 am, Alyssa Kwan alyssa.c.k...@gmail.com 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 Clojure group

Re: (ab)using STM for longish calculations, network I/O

2010-10-15 Thread Alyssa Kwan
On Oct 15, 7:57 pm, peter veentjer alarmnum...@gmail.com wrote: On Oct 15, 2:51 pm, hobnob hob...@ml1.net 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

Re: Function Design: sequence or argument?

2010-11-15 Thread Alyssa Kwan
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 christopher.ma...@gmail.com wrote: If you have a function that needs to treat multiple

Re: Incorrect behaviour for large s-expressions :(

2010-11-15 Thread Alyssa Kwan
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

Re: Closures eat permgen?

2010-11-15 Thread Alyssa Kwan
If you look at the bytecode for the closures, you'll see that the Var that *ns*/a points to is resolved at clinit 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

Re: Closures eat permgen?

2010-11-15 Thread Alyssa Kwan
a...@malloys.org wrote: On Nov 15, 12:12 pm, Alyssa Kwan alyssa.c.k...@gmail.com 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

Dynamic Binding of Self-Referencing Functions Expected Behavior?

2010-11-16 Thread Alyssa Kwan
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 are subscribed to the Google Groups Clojure group

Re: Dynamic Binding of Self-Referencing Functions Expected Behavior?

2010-11-16 Thread Alyssa Kwan
, 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 dnolen.li...@gmail.com wrote: But that would destroy one of the most useful

Ghost Vars?

2010-11-16 Thread Alyssa Kwan
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, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your

Re: Ghost Vars?

2010-11-17 Thread Alyssa Kwan
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 a...@meshy.org wrote: Hi Alyssa, Alyssa Kwan alyssa.c.k...@gmail.com writes: ns-unmap

Re: Dynamic Binding of Self-Referencing Functions Expected Behavior?

2010-11-17 Thread Alyssa Kwan
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 stuart.hallo...@gmail.com wrote: In 1.2, functions were always looked up through their vars. While this is a low

Re: Dynamic Binding of Self-Referencing Functions Expected Behavior?

2010-11-17 Thread Alyssa Kwan
Thanks everyone! Alyssa Kwan On Nov 17, 11:10 am, Stuart Halloway stuart.hallo...@gmail.com 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

Re: Ghost Vars?

2010-11-17 Thread Alyssa Kwan
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, Alyssa Kwan On Nov 17, 8:20 pm

Re: Ghost Vars?

2010-11-18 Thread Alyssa Kwan
On Nov 17, 10:35 pm, Ken Wesson kwess...@gmail.com wrote: On Wed, Nov 17, 2010 at 9:57 PM, Alyssa Kwan alyssa.c.k...@gmail.com 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

Re: Ghost Vars?

2010-11-18 Thread Alyssa Kwan
On Nov 18, 1:49 am, Alex Osborne a...@meshy.org 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

ANN: Durable Clojure - Functions and Closures

2010-11-24 Thread Alyssa Kwan
. 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 unsubscribe from this group

Re: why not change type compare functions do a compare on strings as well?

2010-11-29 Thread Alyssa Kwan
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 tim.blacks...@gmail.com wrote: why not change type compare functions do a compare on strings as well? (defn         ([x] true)   ([x y](if (string? x)

Re: functional thinking

2010-12-01 Thread Alyssa Kwan
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!).