On Wed, Nov 11, 2009 at 10:46 PM, Kevin Tucker wrote:
> Yeah, sorry, missed that.
>
> How does making the gensyms unreadable make things worse for
> macroexpand than they are in CL?
It doesn't. Just worse than they currently are in Clojure. :)
--
You received this message because you are subsc
On Wed, Nov 11, 2009 at 2:04 PM, Nick Day wrote:
> Hi,
>
> I've been trying to implement a topological sort and have been
> struggling a bit. I have a map of symbol vs collection of symbols
> like:
>
> {a [b c], b [c], c [nil]}
>
> which can be read as 'a' depends on 'b' and 'c', 'b' depends on '
Nick Day writes:
> I've been trying to implement a topological sort and have been
> struggling a bit. I have a map of symbol vs collection of symbols
> like:
>
> {a [b c], b [c], c [nil]}
>
> which can be read as 'a' depends on 'b' and 'c', 'b' depends on 'c'
> and 'c' doesn't depend on anything.
I often have to manipulate keywords and symbols. A symbol name needs
a string appended in a macro, a keyword uses underscores instead of
dashes.
In order to do this, I usually transform them into a string, do some
manipulation, and then turn the result back into a keyword/symbol.
This pattern sho
Yeah, sorry, missed that.
How does making the gensyms unreadable make things worse for
macroexpand than they are in CL? If the gensym is used more than once
in the expansion (like bound to something in a let then referenced),
then reading the expansion back in will read two different symbols and
Hi everyone. I wrote a CSV parsing and output library for my own uses
when I didn't see another one available. Someone on #clojure suggested
it might be of general interest for clojure.contrib. If you guys
agree, I'm happy to do whatever is necessary to assist with that.
The code is at http://gith
Hi,
I've been trying to implement a topological sort and have been
struggling a bit. I have a map of symbol vs collection of symbols
like:
{a [b c], b [c], c [nil]}
which can be read as 'a' depends on 'b' and 'c', 'b' depends on 'c'
and 'c' doesn't depend on anything. I've been trying to write
nchubrich wrote:
> I'm curious what the best idiomatic way of handling events is (e.g.
> receiving a series of messages and dispatching functions on the basis
> of the messages). One could use the 'experimental' add-watch(er)
> functions. But it might also be nice to do something stream-oriented,
Mine is almost the same:
Vim 7.2, vimclojure 2.1.2, java 1.6.0_10
On Thu, Nov 12, 2009 at 10:47 AM, MarkSwanson wrote:
> > Does anyone know why if the first character in my *.clj file is '#', then
> > when I open it in VIM, ClojureVIM fails to recognise it as a Clojure
> file?
>
> I don't know w
I'm curious what the best idiomatic way of handling events is (e.g.
receiving a series of messages and dispatching functions on the basis
of the messages). One could use the 'experimental' add-watch(er)
functions. But it might also be nice to do something stream-oriented,
e.g. a doseq on a stream
Warren Wood writes:
> Thought of this, which I like better. Again, I'm surprised if
> conjunction is not already a standard function, but I can't find it.
> I'm still a bit tempted to call it AND for readabilty of code. (I
> spent some time studying combinatory logic back in the day. (I even
>
Try looking at this:
http://github.com/hlship/cascade/blob/master/src/main/clojure/cascade/mock.clj
On Thu, Nov 5, 2009 at 5:00 AM, vanallan wrote:
>
> Hi
> Im trying to convert a couple of Java methods in a Java project to
> Clojure. The Java methods have test methods that mocks other part of
> Does anyone know why if the first character in my *.clj file is '#', then
> when I open it in VIM, ClojureVIM fails to recognise it as a Clojure file?
I don't know why, but I can provide this data point:
It does not do that for me.
Vim 7.2, vimclojure 2.1.2, java 6.0.14
--
You received this me
John Ky wrote:
> I had to ~(keyword (str sym)) instead of ~(keyword sym), but now it
> works well.
Hmm, odd. Must have changed since Clojure 1.0. (keyword 'some-symbol)
works for me on the "new" branch.
--
You received this message because you are subscribed to the Google
Groups "Clojure" gr
Hi Alex,
I had to ~(keyword (str sym)) instead of ~(keyword sym), but now it works
well.
Cheers,
-John
On Thu, Nov 12, 2009 at 12:40 AM, Alex Osborne wrote:
> John Ky wrote:
> > Hi all,
> >
> > I'm looking for a way to write a defkw macro so that (defkw ABSENT)
> > expands to
> > (def ABSENT
Thanks,
On Thu, Nov 12, 2009 at 12:34 AM, Alex Osborne wrote:
> John Ky wrote:
> > How to I print without spaces?
>
> (println (str "a" "b" "c"))
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@g
Hi all,
Does anyone know why if the first character in my *.clj file is '#', then
when I open it in VIM, ClojureVIM fails to recognise it as a Clojure file?
Thanks
-John
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send em
Thanks Howard. Another great answer.
Morten
On Nov 12, 2:58 am, Howard Lewis Ship wrote:
> Symbols are late resolved to functions.
>
> (def t (fn ...)) means define a Var bound to symbol t, and store the
> function in it. In JVM terms, the function becomes a new class that is
> instantiated.
>
>
Great answer Alex. Thanks!
Morten
On Nov 12, 12:34 am, Alex Osborne wrote:
> mbrodersen wrote:
> > In this simple recursive expression:
>
> > (def t (fn [x] (if (zero? x) 0 (+ x (t (dec x))
>
> > The fn special form is evaluated within a context where t is not yet
> > bound.
>
> > t is only
I like almost all of this a lot. My only disagreement is on prefix
lists ... I wouldn't want to lose them, and in fact would prefer to
see them extended to recursive prefix lists (trees).
-Jason
On Nov 11, 10:12 am, "Stephen C. Gilardi" wrote:
> On Nov 10, 2009, at 9:08 PM, John Harrop wrote:
>
On Wed, Nov 11, 2009 at 3:54 PM, Laurent PETIT wrote:
> 2009/11/11 Andrew Boekhoff :
> >> > (:uses [clojure.core :exclude [read])
> >> > [clojure.contrib.graph]
> >> > [clojure.contrib.fcase]
> >> > [clojure.contrib.stream-utils :as su]
> >> > [clojure.contrib.def
2009/11/11 Andrew Boekhoff :
>> > (:uses [clojure.core :exclude [read])
>> > [clojure.contrib.graph]
>> > [clojure.contrib.fcase]
>> > [clojure.contrib.stream-utils :as su]
>> > [clojure.contrib.def :refer-all true]
>> > [clojure.contrib.except :refer-all tr
Hi!
On Wed, Nov 11, 2009 at 7:12 PM, Stephen C. Gilardi wrote:
> Here are some of the ideas I've liked best for how to do it.
I like where this is heading.
> - don't "refer" any names from the target namespace into the current
> namespace by default
YES!
> - support ":only []", ":rename {}",
On Wed, Nov 11, 2009 at 1:12 PM, Stephen C. Gilardi wrote:
>
> Here are some of the ideas I've liked best for how to do it.
Thanks for pulling this together. I like the whole direction
you're going here.
> - require that each "libspec" (reference to a lib) be a vector, disallowing
> naked symbo
Just use first and second for both cases.
On Nov 11, 9:52 am, samppi wrote:
> Clojure 1.1.0-alpha-SNAPSHOT
> user=> (conj (first {1 2}) 3)
> [1 2 3]
> user=> (conj {1 2} [2 5])
> {2 5, 1 2}
> user=> (key (first {1 2}))
> 1
> user=> (key [1 2])
> java.lang.ClassCastException: clojure.lang.Persist
> > (:uses [clojure.core :exclude [read])
> > [clojure.contrib.graph]
> > [clojure.contrib.fcase]
> > [clojure.contrib.stream-utils :as su]
> > [clojure.contrib.def :refer-all true]
> > [clojure.contrib.except :refer-all true]
> > [clojure.contrib.se
On Wed, Nov 11, 2009 at 1:12 PM, Stephen C. Gilardi wrote:
> Before:
>
> (:refer-clojure :exclude [read])
> (:require (clojure.contrib [graph :as graph] [fcase :as fcase])
>[clojure.contrib.stream-utils :as su])
> (:use [clojure.contrib def except server-socket]
>clojure.con
On Nov 10, 2009, at 9:08 PM, John Harrop wrote:
(ns foo.bar.baz
(:use [clojure.contrib.core :only (seqable?)]))
(and thus violates the usual clojure rule of using vectors rather
than lists for groupings that are not invocations -- that is,
function calls, macro calls, or special form cal
Clojure 1.1.0-alpha-SNAPSHOT
user=> (conj (first {1 2}) 3)
[1 2 3]
user=> (conj {1 2} [2 5])
{2 5, 1 2}
user=> (key (first {1 2}))
1
user=> (key [1 2])
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be
cast to java.util.Map$Entry (NO_SOURCE_FILE:0)
In all respects but one, two-
Check out this post for some suggestions on working with Clojure in a
distributed fashion.
http://groups.google.com/group/clojure/msg/4a7a866c45dc2101
-Travis
On Nov 9, 2:09 pm, Michael Jaaka wrote:
> Hi!
>
> Is there any support from Clojure for communication between procesess
> by sockets?
Symbols are late resolved to functions.
(def t (fn ...)) means define a Var bound to symbol t, and store the
function in it. In JVM terms, the function becomes a new class that is
instantiated.
(t (dec x)) means locate the Var bound to symbol t -- at execution
time (not compilation time) --- de-r
Hello,
On Wed, Nov 11, 2009 at 2:57 PM, Albert Cardona wrote:
> YES please. If I could upvote this message I would.
>
> A half-a-dozen of examples on ns/in-ns and require/use/refer and the
> differences in using them at the prompt or inside a ns would be
> fantastic.
Some more ns documentation i
Hi,
On Nov 11, 2:34 pm, Alex Osborne wrote:
> (let [t (fn [x] (if (zero? x) 0 (+ x (t (dec x)] (t 2))
But also note, that you can give an anonymous function a name. %)
(let [t (fn t [x] (if (zero? x) 0 (+ x (t (dec x)] (t 2))
Sincerely
Meikel
--
You received this message because you
John Ky wrote:
> Hi all,
>
> I'm looking for a way to write a defkw macro so that (defkw ABSENT)
> expands to
> (def ABSENT (kw "ABSENT" :ABSENT )).
>
Just use `(...) as a template and use ~ to unescape, like so:
(defmacro defkw [sym]
`(def ~sym (kw ~(str sym) ~(keyword sym
(defkw ANSE
Hi,
(println (str "a" "b" "c"))
Regards,
Lauri
On Wed, Nov 11, 2009 at 9:15 AM, John Ky wrote:
> Hi all,
>
> How to I print without spaces?
>
> For example:
>
> (println "a" "b" "c")
>
> Gives:
>
> a b c
>
> Rather than
>
> abc
>
> Thanks,
>
> -John
>
> --
> You received this message
John Ky wrote:
> How to I print without spaces?
(println (str "a" "b" "c"))
--
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 patie
mbrodersen wrote:
> In this simple recursive expression:
>
> (def t (fn [x] (if (zero? x) 0 (+ x (t (dec x))
>
> The fn special form is evaluated within a context where t is not yet
> bound.
>
> t is only bound AFTER fn has captured its environment.
>
> In other words, the closure captured
Hi all,
I'm looking for a way to write a defkw macro so that (defkw ABSENT) expands
to
(def ABSENT (kw "ABSENT" :ABSENT )).
Thanks,
-John
--
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
Hi all,
How to I print without spaces?
For example:
(println "a" "b" "c")
Gives:
a b c
Rather than
abc
Thanks,
-John
--
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 t
On Nov 10, 2:28 am, John Harrop wrote:
> (I suppose T and F are static fields holding java.lang.Booleans, and this
> code was written pre-autoboxing?)
It's still much faster to use a "pre-boxed Boolean" than to create a
new boxed value every time around.
Kresten
--
You received this message
(doc some) says:
"... this will return true if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)"
However, some returns the matching value instead:
=> (some #{:fred} [:foo :fred :ethel])
:fred
Attached patch fixes the docstring. (Not that applying the patch would
be any easier than
A quick question about how closures work in Clojure.
In this simple recursive expression:
(def t (fn [x] (if (zero? x) 0 (+ x (t (dec x))
The fn special form is evaluated within a context where t is not yet
bound.
t is only bound AFTER fn has captured its environment.
In other words, the c
YES please. If I could upvote this message I would.
A half-a-dozen of examples on ns/in-ns and require/use/refer and the
differences in using them at the prompt or inside a ns would be
fantastic.
The ns macro is one of the obscure corners of clojure. It relates to
the java class path problem, and
43 matches
Mail list logo