(deftype Account [owner balance])
(deftype Person [accounts])
joe has 1 account.
How to I create / initialize joe the account with mutual references?
I'd rather not use refs.
Thanks!
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
On Apr 5, 2010, at 2:09 AM, Sophie wrote:
(deftype Account [owner balance])
(deftype Person [accounts])
joe has 1 account.
How to I create / initialize joe the account with mutual references?
I'd rather not use refs.
You can't do it directly without one of the two being mutable. But
You need a level of indirection. One way is to make the backward
reference from accounts to owners be based on a non-pointer primary
key (maybe a keyword) that can be resolved through some table. This is
how it works in relational database systems
If you want to use references of some sort,
The docs say what characters are guaranteed future-safe for *you* to
use in symbols, nothing more. I don't see what's so puzzling about
this.
On Apr 4, 8:33 pm, Douglas Philips d...@mac.com wrote:
(This is a follow up to my query last week, where upon I didn't fully
connect these dots)
If this is significantly faster than c.c.seq/shuffle, you should
submit a patch. I know Rich was complaining about the speed of that
fn in the past.
Also, I'd reverse the arg order of with-transient. I think
(with-transient f x)
reads easier. Also, it should probably end with a bang, because
In my experiments my code is still about 1.5x slower than
seq-utils.shuffle. The current implementation of seq-utils.shuffle
simply converts to an ArrayList, calls java.util.Collections.shuffle,
and converts back to a Clojure sequence. Here's a quick experiment:
user (def v (vec (range 50)))
Thanks for the help! I found and corrected a few more errors. You can
see the final result with documentation, at http://gist.github.com/354147
.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Something is still off here. Leiningen compiles the IFoo interface first but
compilation of Foo still cannot find IFoo. I've included the (:requires)
statement as described. (:gen-class) is part of the ns declaration. Any
other ideas?
--- src/proj/IFoo.clj ---
(ns proj.IFoo
(:import ...)
Hi,
I have some problem with swank-clojure installation. Since I already
had SLIME/SBCL setup on my box so I followed some guide (http://
tentclube.blogspot.com/2010/01/manual-installation-not-using-elpa-
of.html).
The problem is the clojure didn't appear in slime-lisp-
implementations variable
I'm overwhelmed by the answers, thank you all! Now back to the REPL.
/Linus
2010/4/5 Per Vognsen per.vogn...@gmail.com
On Mon, Apr 5, 2010 at 11:33 AM, Lee Spector lspec...@hampshire.edu
wrote:
Ah -- maybe that foiled my timings too. I didn't expect it to be fast --
just clear (at least
Hi!
Some leiningen questions:
1. It seems that the resources directory does not get added to the
classpath, even though the docs say so. I tried to use :resoures flag,
but still, it did not work. Any idea?
2. Is there some support for profiles in leiningen? (Eg. I'd like to
have a
Is this a Clojure restriction, or is it intrinsic to functional
programming?
If my app is essentially about a user creating and editing a graph
structure (sometimes via crud-level interactions, other times by
somewhat larger refactorings), is either Clojure or functional not a
good match?
Thanks
On Apr 5, 2010, at 7:49 AM, Sophie wrote:
Is this a Clojure restriction, or is it intrinsic to functional
programming?
It's a consequence of immutable data structures, which are an aspect of
functional programming. An immutable object can never be changed, and you can't
create multiple
On 2010 Apr 5, at 3:49 AM, ataggart wrote:
The docs say what characters are guaranteed future-safe for *you* to
use in symbols, nothing more. I don't see what's so puzzling about
this.
I asked a specific question:
Is it really still an open question that the comparison functions
would be
Oh yeah, we should fix the reader page to acknowledge that we've
used these characters in symbols already
The reader already has a macro associated with \, the character
literal.
user= (int \)
62
user= (str \)
user= (first )
\
HTH,
Sean
On Apr 5, 11:19 am, Douglas Philips d...@mac.com wrote:
The classpath problem is a swank-clojure issue that's been fixed in git. We
should have a new release soon; in the mean time lein swank will work. Else
you can manually upgrade to the latest swank-clojure.el with M-x
package-install-from-buffer.
Development vs production properties is out of the
Hello,
if I include the follwing lines in my maven pom, shouldn't I have some
line editing stuff (like cursor up or so) even in Emacs' eshell?
(I ask because this is the only shell I get an keyboard echo.)
dependency
groupIdjline/groupId
artifactIdjline/artifactId
version0.9.9/version
Tried that, not working. It gave me Wrong type argument: stringp,
126 error in mini buffer. I don't think that's the problem, most
'.emacs I saw on internet doesn't use that.
On Apr 5, 9:43 pm, ubolonton ubolon...@gmail.com wrote:
Maybe you forgot this
(ad-activate
On Apr 2, 3:28 pm, Chas Emerick cemer...@snowtide.com wrote:
As Clojure moves towards being self-hosted, fewer and fewer of the
data structures will be implemented in Java, thereby ensuring
dependence on the Clojure runtime. Just FYI.
Yes, I've realized that as well :-) I would have to
On Apr 5, 3:06 pm, ineol leo.l...@gmail.com wrote:
It has nothing to do with Clojure but your colleague can look at the
Google collection library that contains an
ImmutableSet.http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/co...
Yes, there is also Scalas data structures
Take a look here and see if this is useful.
http://www.mohegan-skunkworks.com/adding-clojure-to-an-existing-slime-setup-in-emacs.html
http://www.mohegan-skunkworks.com/adding-clojure-to-an-existing-slime-setup-in-emacs.htmlFWIW
: I'm able tor run multiple lispen plus clojure. There's a bit of
On 5 April 2010 17:25, Sean Devlin francoisdev...@gmail.com wrote:
Oh yeah, we should fix the reader page to acknowledge that we've
used these characters in symbols already
The reader already has a macro associated with \, the character
literal.
user= (int \)
62
user= (str \)
user=
On 2010 Apr 5, at 4:15 PM, Michael Wood wrote:
I think his question should be read as if he had not included any
backslashes anywhere. i.e. he's asking about , , and =. Not \ or
\ etc.
Well, I was/am trying to be precise.
Symbols are looked up by strings and strings contain characters,
It's a consequence of immutable data structures, which are an aspect of
functional programming. An immutable object can never be changed
But single-assignment is a quite valid (and more flexible?) form of
immutability. I'm not convinced cycles are intrinsically tied to it in
any way.
(In
On Apr 5, 2010, at 4:34 PM, Sophie wrote:
But single-assignment is a quite valid (and more flexible?) form of
immutability. I'm not convinced cycles are intrinsically tied to it in
any way.
If you can assign to it, it's mutable. What you're talking about is creating a
mutable object, then
On 2010-04-04, at 2:47 PM, Mark Engelberg wrote:
I don't understand why you need to get rid of the delay once it has been
updated. Delays are cheap; why not just be consistent about having your
data be a ref of a delay? It will keep your code simpler, and that's well
worth it.
That's one
It's no more mutable than a pure lambda calculus with lazy evaluation.
There is no _observable_ mutability. Anything else is an
implementation detail.
Single assignment comes from the tradition of logic programming and
concurrent process calculus rather than lambda calculus. A single
assignment
Why this behavior?
user= (#{5 nil} 5)
5
user= (#{5 nil} 4)
nil
user= (#{5 nil} nil)
nil
rather than the seemingly more informative:
user= (#{5 nil} 5)
true
user= (#{5 nil} 4)
false
user= (#{5 nil} nil)
true
user= (#{5 false} true)
false
user= (#{5 false} false)
true
i.e. set as characteristic
Why this behavior?
It's useful: e.g., you can use a set as a filter.
user= (filter #{2 3 4 5} (range 1 10))
(2 3 4 5)
If you want your alternative, use contains?:
user= (contains? #{true false} false)
true
--
You received this message because you are subscribed to the Google
Groups Clojure
On Mon, Apr 5, 2010 at 8:56 PM, Richard Newman holyg...@gmail.com wrote:
Why this behavior?
It's useful: e.g., you can use a set as a filter.
user= (filter #{2 3 4 5} (range 1 10))
(2 3 4 5)
filter works just as well with a function that returns true and false, so
that's not a
filter works just as well with a function that returns true and
false, so that's not a particularly good example.
Heh, that's true. Should have re-read :)
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
On Apr 6, 2010, at 12:20 AM, Mark Engelberg mark.engelb...@gmail.com
wrote:
On Mon, Apr 5, 2010 at 8:56 PM, Richard Newman holyg...@gmail.com
wrote:
Why this behavior?
It's useful: e.g., you can use a set as a filter.
user= (filter #{2 3 4 5} (range 1 10))
(2 3 4 5)
filter works just
Mark Engelberg mark.engelb...@gmail.com writes:
filter works just as well with a function that returns true and false,
so that's not a particularly good example.
Calling the set as if it is a fn is a short-hand for get, that is
retrieving an element from the set. Why would you want to do this,
Possibly this fall out from the latest commit requiring an explicit
'this' reference (ba6cc3b), I haven't checked any versions but the
most recent.
user (defprotocol Protocol (f [a b c]))
Protocol
user (def p (reify Protocol (f [a b c] [a b c])))
#'user/p
user (f p :a)
No single method: f of
34 matches
Mail list logo