At first I found this kind of confusing, but after reading Chouser's
article and the help. It makes a lot of sense. I found it easiest to
understand when I thought about it as two pairs of related names. The
first/rest pair and the seq/more pair.
--~--~-~--~~~---~--~---
> I don't quite understand why you got through all that work to get
> error-str -- isn't it just (str (qualify-sym error-type))?
>
> ...and since you then use it only as an arg to 'symbol' or 'str', you
> could just use the symbol itself instead of converting it to a string
> and back.
>
If I brin
On Thu, Feb 5, 2009 at 2:59 PM, Nathan Cunningham wrote:
>
> Yup, that solves it.
> A while back the blah# didn't support working in nested back ticks. I
> hadn't realized they fixed it. Or for that matter added condp :)
The auto-gensym behavior hasn't changed.
user=> `(foo# ~(vector `foo#))
(f
On Wed, Jan 28, 2009 at 6:17 PM, Peter Wolf wrote:
>
> How about this? Needlessly wordy to make it more search-able...
>
> clojure.core/count
> ([coll])
> Returns the length of a list or vector, the number of keys in a map,
> the size of a string, or the number of items in a sequence or
> colle
On Mon, Feb 16, 2009 at 12:25 AM, David Nolen wrote:
> (defmethod assert-expr 'raised? [msg form]
> (let [error-type (second form)
> error-meta (meta (find-var (qualify-sym error-type)))
> error-str (str (ns-name (:ns error-meta)) "/" (:name error-meta))
> body (rrest form)]
Heh not macro, I meant multimethod.
Here is the macro that seems to work, any improvements much appreciated ;)
> This fails when no error is raised, when the wrong error type is raised, and
> I believe it's captures errors which are derived but not the exact error (is
> this a weird behavior?). Y
On Sun, Feb 15, 2009 at 6:44 PM, Rich Hickey wrote:
> I realize you are focused on filter, but that point of the fully lazy
> branch is full laziness, which would not fall out of what you
> describe. lazy-cons requires the lazy sequence function do all the
> work that precedes the call to lazy-co
(defmethod assert-expr 'raised? [msg form]
(let [error-type (second form)
error-meta (meta (find-var (qualify-sym error-type)))
error-str (str (ns-name (:ns error-meta)) "/" (:name error-meta))
body (rrest form)]
`(with-handler
(do
~...@body
(report :fail ~msg
On Feb 15, 11:46 pm, Feng wrote:
> I tried to migrate swank-clojure to lazy branch rev1282. Here are
> steps I did.
>
> 1) search and replace rest to next
> 2) search and replace seq? to sequence?
> 3) change lazy-cons to lazy-seq following the recipe
> 4) fixed if LazySeq exceptions
>
> see at
On Feb 15, 2:44 pm, timc wrote:
> I'm new to Clojure, just thought I would share this.
> I was playing around, trying to understand Atoms and I devised a
> function that generates the next value in the Fibonacci sequence each
> time it is called.
>
> (def fib-gen-val (atom [1 1]))
>
> (defn fib
On Sun, Feb 15, 2009 at 10:06 PM, David Nolen wrote:
> I've been attempting to combine error-kit and test-is, but getting the
> relation between assert-expr form in test-is and the handle form in
> error-kit is a bit tricky. Looking at the test-is thrown? example and
> Chouser's error-kit post on
I tried to migrate swank-clojure to lazy branch rev1282. Here are
steps I did.
1) search and replace rest to next
2) search and replace seq? to sequence?
3) change lazy-cons to lazy-seq following the recipe
4) fixed if LazySeq exceptions
see attached diff at the end.
Code loads fine. However, I
On Sun, Feb 15, 2009 at 10:50 PM, David Nolen wrote:
> Would it be possible to make the arguments to handle be optional? Is this a
> good or bad idea?
(kit/with-handler
(vec (map int-half [2 4 5 8]))
(kit/handle *odd-number-error* [n]
(throw (Exception. (format "Odd number %d in vector."
> I'm sure it can be done, but it's not clear to me if you have a vector of
> vectors
> how Stuart's solution would work:
>
> 1:15 user=> (map vector vecs)
([[:a0 :a1 :a2]] [[:b0 :b1 :b2]])
(apply (partial map vector) [[1 2 3] ['a 'b 'c] ["cat" "dog" "bird"]])
works on a vector of vectors. The
>From the original question it looked like there was a vector of unknown
length of vectors
[[a0 a1 a2] [b0 b1 b2] ...]
So my solution is something like:
1:12 user=> (def vecs [[:a0 :a1 :a2] [:b0 :b1 :b2]])
#'user/vecs
1:13 user=> (partition (count vecs) (interleave (flatten vecs)))
((:a0 :a1) (:
Would it be possible to make the arguments to handle be optional? Is this a
good or bad idea?
It seems to me, in the case of setting up test fixtures that check for
raised errors, often you don't care what arguments the error takes.
David
On Fri, Feb 6, 2009 at 9:10 PM, Chouser wrote:
> (kit/
For those looking to get this working on Mac OS X, this worked for me:
(Tested using revision 22594, IDEA 8.1, 32-bit Macintel with Java 1.5
and Mac OS X 10.5.6)
- $ mkdir ~/clojure-build-dir
- $ cd ~/clojure-build-dir
- $ mkdir ~/clojure-build-dir/fake-idea-home
- $ cd ~/clojure-build-dir/fake-
I've been attempting to combine error-kit and test-is, but getting the
relation between assert-expr form in test-is and the handle form in
error-kit is a bit tricky. Looking at the test-is thrown? example and
Chouser's error-kit post on the mailing list I tried something like the
following:
(defme
Of course ;) Keep forgetting the obvious things.
On Sun, Feb 15, 2009 at 9:36 PM, Stuart Halloway
wrote:
>
> (map vector [1 2 3] ['a 'b 'c] ["cat" "dog" "bird"])
> -> ([1 a "cat"] [2 b "dog"] [3 c "bird"])
>
> > Actually something closer to your exact expression is this:
> >
> > (apply (partial m
On Feb 15, 2009, at 8:22 PM, Mark Engelberg wrote:
>
> My thoughts so far:
>
>
> 4. The new model is definitely more complicated to understand than
> the previous model. There was already a certain degree of mental
> overlap between collections and the seq interface. Now, there is also
> the
(map vector [1 2 3] ['a 'b 'c] ["cat" "dog" "bird"])
-> ([1 a "cat"] [2 b "dog"] [3 c "bird"])
> Actually something closer to your exact expression is this:
>
> (apply (partial map (fn [& rest] (apply vector rest))) [[1 2 3] ['a
> 'b 'c] ["cat" "dog" "bird"]])
>
> On Sun, Feb 15, 2009 at 7:42 P
My thoughts so far:
1. It always troubled me that filter, when written in the most
natural way, had a "hang on to the head" problem when skipping over
large numbers of items. I think this is something worth solving, and
I'm glad that while developing the lazier branch, you came up with a
compil
On Feb 15, 6:34 pm, "James G. Sack (jim)" wrote:
> Rich Hickey wrote:
> >..
> > The second option is to choose the best possible names, and deal with
> > some short term pain in porting and confusion. I think the best names
> > are:
>
> > ;item
> > (first x)
>
> > ;collection of remaining items
Thanks a lot. I didn't know that map could take multiple collections.
On Feb 15, 5:47 pm, David Nolen wrote:
> Actually something closer to your exact expression is this:
>
> (apply (partial map (fn [& rest] (apply vector rest))) [[1 2 3] ['a 'b 'c]
> ["cat" "dog" "bird"]])
>
> On Sun, Feb 15, 2
Actually something closer to your exact expression is this:
(apply (partial map (fn [& rest] (apply vector rest))) [[1 2 3] ['a 'b 'c]
["cat" "dog" "bird"]])
On Sun, Feb 15, 2009 at 7:42 PM, David Nolen wrote:
> (map (fn [& rest] (apply vector rest)) [1 2 3] ['a 'b 'c] ["cat" "dog"
> "bird"])
>
(map (fn [& rest] (apply vector rest)) [1 2 3] ['a 'b 'c] ["cat" "dog"
"bird"])
On Sun, Feb 15, 2009 at 7:16 PM, samppi wrote:
>
> What would I do if I wanted this:
>
> [[a0 a1 a2] [b0 b1 b2] ...] -> [[a0 b0 ...] [a1 b1 ...] [a2 b2 ...]]
>
> I could write a loop, I guess, but is there a nice, id
While it's not the most important issue, I agree with CuppoJava about
"Sequence" vs "Seq", while we're talking about names. This pair of
terms seems sort of arbitrary, and will probably cause a little
semantic pain and confusion to newcomers in the future. Is there a
better term than "Sequence" an
What would I do if I wanted this:
[[a0 a1 a2] [b0 b1 b2] ...] -> [[a0 b0 ...] [a1 b1 ...] [a2 b2 ...]]
I could write a loop, I guess, but is there a nice, idiomatic,
functional way of doing this? I didn't spot a way in
clojure.contrib.seq-utils either.
--~--~-~--~~~--
On Feb 14, 9:13 pm, "Stephen C. Gilardi" wrote:
> On Feb 14, 2009, at 11:10 PM, Chouser wrote:
>
> > I don't think that's quite right. I don't think it matters in this
> > case, but hash values aren't guaranteed unique. A hash-map can have
> > two keys with the same hash value as long as = retu
In testing some code in clojure.main I needed a macro to set system
properties, run the test, and pop off the properties. If others find this
useful, we can make it more accessible in contrib. Look here if you're
interested:
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/c
How about next-seq or rest-seq?
On Sun, Feb 15, 2009 at 3:34 PM, James G. Sack (jim) wrote:
>
> Rich Hickey wrote:
>>..
>> The second option is to choose the best possible names, and deal with
>> some short term pain in porting and confusion. I think the best names
>> are:
>>
>> ;item
>> (first
At the risk of over-complicating things, perhaps there should be a
macro/function to "require" a specific version of Clojure? In this
way, a script written for the "new" naming could prevent itself from
executing incorrectly using the old naming. Something like Python's
"from future" concept.
O
Rich Hickey wrote:
>..
> The second option is to choose the best possible names, and deal with
> some short term pain in porting and confusion. I think the best names
> are:
>
> ;item
> (first x)
>
> ;collection of remaining items, possibly empty
> (rest x)
>
> ;seq on next item, or nil if none
I prefer first/rest/next.
Because of where the book is in the production cycle, it will be
difficult for me to change the prose. But if this gets decided (and
clojure-contrib updated) in the next week or two I think I can get the
book printed with the changes incorporated throughout.
Cheer
On Feb 15, 2009, at 5:09 PM, Konrad Hinsen wrote:
>
> On 15.02.2009, at 23:00, Konrad Hinsen wrote:
>
>> For those who want to play with this without keeping two versions of
>> their source code files, I have added a new macro lazy-and-standard-
>> branch to clojure.contrib.macros. Here is an ex
Hi sun,
This sounds related to tree-flattening. If you search the google
group with keyword "flatten", I think you'll discover some indirectly
useful information.
Kev
On Feb 16, 3:55 am, wubbie wrote:
> So destructuring is essentially doing (first coll) for each parameter
> and the rest i
On Sun, Feb 15, 2009 at 5:03 PM, Stephen C. Gilardi wrote:
>
> Should we branch contrib and do the fixups on a lazy branch? Chouser, have
> you already fixed it enough to compile with clojure contrib's build.xml?
I don't ever compile clojure-contrib, I just put its src dir in my
classpath. I've
On Feb 15, 2009, at 5:01 PM, Mark Engelberg wrote:
>
> On Sun, Feb 15, 2009 at 1:44 PM, Chouser wrote:
>> (defn my-interpose [x coll]
>> (loop [v [x] coll coll]
>> (if (seq coll) ; Don't assume coll is a seq-or-nil
>> (recur (-> v (conj (first coll)) (conj x)) (rest coll))
>>
On Feb 15, 2009, at 4:44 PM, Chouser wrote:
>
> Here's an example of what I think will be the worst kind of breakage
> resulting from changing the meaning of rest from
> seq-on-the-next-item-if-any-else-nil to
> possibly-empty-collection-of-the-remaining-items:
>
> (defn my-interpose [x & coll]
On Feb 15, 2009, at 5:03 PM, Stephen C. Gilardi wrote:
Based on it working for you, the current theory I'm working to
verify is that this was caused by a clojure-contrib.jar compiled
with trunk interacting with a clojure.jar from lazy 1282.
I've confirmed this. Thanks for the help. The tes
On 15.02.2009, at 23:00, Konrad Hinsen wrote:
> For those who want to play with this without keeping two versions of
> their source code files, I have added a new macro lazy-and-standard-
> branch to clojure.contrib.macros. Here is an example of how to use it:
BTW, my library modules in clojure.
On Feb 15, 2009, at 4:52 PM, Chouser wrote:
I just tried this on 1282 lazy branch with assert-if-lazy-seq, and I
get no exception and no hang:
user=> (time (db-write))
"Elapsed time: 802.020886 msecs"
I wonder what's different?
Based on it working for you, the current theory I'm working to
On Sun, Feb 15, 2009 at 1:44 PM, Chouser wrote:
> (defn my-interpose [x coll]
> (loop [v [x] coll coll]
>(if (seq coll) ; Don't assume coll is a seq-or-nil
> (recur (-> v (conj (first coll)) (conj x)) (rest coll))
> v)))
You know, there is an empty? predicate. Why not wr
On 15.02.2009, at 18:18, Rich Hickey wrote:
> I've been working on this for a few months, in lieu of more
> interesting things, because I knew it would be a breaking change and
> we're trying to get the biggest of those behind us. I appreciate any
> effort you spend in trying to provide informed
On Feb 15, 2009, at 4:40 PM, Rich Hickey wrote:
Are you burning cycles while hung, or just blocked?
One core is pinned.
--Steve
smime.p7s
Description: S/MIME cryptographic signature
On Sun, Feb 15, 2009 at 4:30 PM, Stephen C. Gilardi wrote:
>
> I'm trying svn rev 1282 with the following test (which depends on javadb,
> (derby)):
>
>user=> (use 'clojure.contrib.sql.test)
>nil
>user=> (db-write)
>
> It hangs there. This works on the trunk.
I just tried
Here's an example of what I think will be the worst kind of breakage
resulting from changing the meaning of rest from
seq-on-the-next-item-if-any-else-nil to
possibly-empty-collection-of-the-remaining-items:
(defn my-interpose [x & coll]
(loop [v [x] coll coll]
(if coll
(recur (-> v (
On Feb 15, 4:30 pm, "Stephen C. Gilardi" wrote:
> On Feb 15, 2009, at 12:18 PM, Rich Hickey wrote:
>
> > I am looking for feedback from people willing to read and understand
> > the linked-to documentation and the fully lazy model, and especially
> > from those trying the lazy branch code and p
On Feb 15, 2009, at 4:30 PM, Stephen C. Gilardi wrote:
- This seems like an opportunity for me to use a Java debugger with
Clojure for the first time. Has anyone written about using JSwat or
another debugger with Clojure?
:-) clojure.org Getting Started page.
--Steve
smime.p7s
Descript
On Feb 15, 2009, at 12:18 PM, Rich Hickey wrote:
I am looking for feedback from people willing to read and understand
the linked-to documentation and the fully lazy model, and especially
from those trying the lazy branch code and porting some of your own.
I'm trying svn rev 1282 with the foll
"It would also break the compatibility of rest with Common Lisp's"
This is of mild concern to me, but I think if there was a prominent
warning on clojure.org, I could get over it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goog
On Feb 15, 2009, at 4:04 PM, Mark Volkmann wrote:
Suppose I have Thread objects in variables named t1, t2 and t3.
Is there an easier way to start all of the threads than this?
(dorun (map #(.start %) [t1 t2 t3]))
(doseq [t [t1 t2 t3]]
(.start t))
--Steve
smime.p7s
Descri
Suppose I have Thread objects in variables named t1, t2 and t3.
Is there an easier way to start all of the threads than this?
(dorun (map #(.start %) [t1 t2 t3]))
--
R. Mark Volkmann
Object Computing, Inc.
--~--~-~--~~~---~--~~
You received this message because y
On Sun, Feb 15, 2009 at 12:31 PM, Mark Volkmann
wrote:
>> The :gen-class is only needed if you want to generate a Java class of
>> a certain stripe. It's not required for AOT compilation in general.
>
> What do you mean by "a certain stripe"? I thought :gen-class was
> needed to save the generate
On Sat, Feb 14, 2009 at 5:44 PM, James Reeves wrote:
>
> On Feb 14, 5:30 pm, Dan wrote:
> > What about making the file an agent and sending write actions to it?
>
> I don't see how that would solve the problem, unless you're suggesting
> that I have a single agent to handle all reads and writes?
On Feb 15, 2:48 pm, Vincent Foley wrote:
> Hello Rich,
>
> I'll play around with the lazy branch this week, and this is just a
> name suggestion: what do you think of first/tail/rest where (rest s)
> == (seq (tail s))? tail is already used in other functional languages
> such as Haskell and OC
It is making more sense now.
One other interesting thing that surprised me is: "There is not a
total ordering across types."
See discussion:
http://groups.google.com/group/clojure/browse_frm/thread/710848919c68981f/51ede18b2fd7ab96?lnk=gst&q=sorted-set#51ede18b2fd7ab96
Therefore things like (so
On 15.02.2009, at 20:48, Vincent Foley wrote:
> I'll play around with the lazy branch this week, and this is just a
> name suggestion: what do you think of first/tail/rest where (rest s)
> == (seq (tail s))? tail is already used in other functional languages
> such as Haskell and OCaml to repres
I agree with the op. While the language is still relatively young
please break things so they sit better in the long term. Accurate and
descriptive names are totally valueable, and I'm pretty handy with
find/replace on the editor anyway :p
Aaron
On Feb 15, 2009, at 10:43 AM, CuppoJava
w
Hello Rich,
I'll play around with the lazy branch this week, and this is just a
name suggestion: what do you think of first/tail/rest where (rest s)
== (seq (tail s))? tail is already used in other functional languages
such as Haskell and OCaml to represent all-but-the-first elements, so
it woul
I'm new to Clojure, just thought I would share this.
I was playing around, trying to understand Atoms and I devised a
function that generates the next value in the Fibonacci sequence each
time it is called.
(def fib-gen-val (atom [1 1]))
(defn fib-gen []
(let [[a b] @fib-gen-val]
(swap! fib
I also favor the optimal names. We're the pioneers in using clojure,
so we should expect a few arrows. Hopefully, the number of clojure
users in the future will be an order of magnitude greater than where
we are now. For us to take short term hit, we can save a large number
of people a lot of c
One thing I did find confusing though was in regards to the doc.
Is there a way to more clearly differentiate between a seq and a
sequence? Up until now, I've always thought of "seq" as just being
shorthand for "sequence" which isn't the case apparently.
--~--~-~--~~~--
>
> classpathref="project.classpath" failonerror="true">
>
>
>
>
>
>
I use this little ant task http://pastebin.com/f34ecde83, with it you
can rewrite your compile target as:
It supports 'classpath' and 'classpathref' attributes like javac and
will try
I'm also in support of the optimal names. Clojure is not too widely
used in production code yet, and it would be a shame to start
compromising design decisions for backwards compatibility already.
This is actually one of my (and many other people's) favorite parts
about Clojure, the beauty of Lis
Thanks Rich,
Expanding into the symbol is clever, but less readable (IMO) than just
expanding into the . form. Anyway, I get it now.
Stuart
> On Feb 15, 2009, at 9:06 AM, Stuart Halloway wrote:
>
>>
>> Does this clarify the point I was making?
>>
>> When writing macros, you cannot dynamically
I would vote that you change to the optimum names, but work with Stu
Halloway to ensure that either his book gets updated before it is
printed, or there is a "cheat sheet" on the Clojure site to translate
from his book to any new names.
On Sun, Feb 15, 2009 at 9:18 AM, Rich Hickey wrote:
>
> I'm
What are some examples of situations where the STM system might decide
to reorder commutes? Does this refer to cases where a transaction
calls commute on more than one Ref and the STM can select the order in
which apply calls are rerun at the end of the current transaction? See
the doc string for
After reading http://clojure.org/refs, it's not clear to me what
situations cause a transaction to retry. Is it when there is an
attempt to change the value of a Ref for which a change has been
committed in another transaction since the current transaction began?
Does this differ based on whether
On Sun, Feb 15, 2009 at 10:38 AM, John D. Hume wrote:
>
>> files? It seems tedious to have to add ":gen-class" to the source
>> file, start a REPL, and enter a compile form.
>
> The :gen-class is only needed if you want to generate a Java class of
> a certain stripe. It's not required for AOT com
I'm pretty much finished with the fully-lazy implementation and am
happy so far with the results. I think this will be an important
addition to Clojure and am planning to add it.
Now comes the hard part - names and change. The essence of the fully
lazy seqs is that they will not consume any resou
Hi folks,
Is there support in Clojure for compiling Java classes with Java
annotations? I looked at the gen-class method, but it doesn't seem to
support this.
If there isn't support for this, is there anyone working on this? If
not, I would like to add this.
cheers
adam
--
Adam Feuer
--~--~---
So destructuring is essentially doing (first coll) for each parameter
and the rest is assigned (rest coll)?
On Feb 15, 11:48 am, wubbie wrote:
> Also how left and right gets mapped magically to (first tree) and
> (rest tree)?
> Is it destructuring? I have some ideas on destructuring but this l
Also how left and right gets mapped magically to (first tree) and
(rest tree)?
Is it destructuring? I have some ideas on destructuring but this left
and right things confuses me...
thanks
sun
On Feb 15, 11:31 am, wubbie wrote:
> thanks,
> it works, although it does not count nil node.
> Anyway
> files? It seems tedious to have to add ":gen-class" to the source
> file, start a REPL, and enter a compile form.
The :gen-class is only needed if you want to generate a Java class of
a certain stripe. It's not required for AOT compilation in general.
It seems most projects do it with an ant t
thanks,
it works, although it does not count nil node.
Anyway, what's the motivation behind using "sequential?" ?
thanks
sun
On Feb 15, 11:23 am, Vincent Foley wrote:
> Sorry about the erroneous function, I think this is more likely what
> you want:
>
> (defn count-leaves [[left & right :as tre
I don't know if this is expected, but I get a Nullpointerexception
when I implement a proxy function and the 'interface' isn't
'imported'. For example, I was refactoring some code and didn't carry
over the import and get this nullpointerexception error. Obviously, I
should just add the import, b
Sorry about the erroneous function, I think this is more likely what
you want:
(defn count-leaves [[left & right :as tree]]
(if (seq tree)
(+ (if (sequential? left)
(count-leaves left)
1)
(count-leaves right))
0))
user> (count-leaves [])
0
user> (count-leaves [
Oh duh, I didn't even implement the correct thing! Sorry :(
On Feb 15, 11:06 am, Vincent Foley wrote:
> I'm not sure if it's "Clojury", but this seems to work:
>
> (defn count-leaves [tree]
> (if (sequential? tree)
> (+ (count-leaves (first tree))
> (count-leaves (rest tree)))
>
thanks,
I'll have a look
On Feb 15, 11:06 am, Vincent Foley wrote:
> I'm not sure if it's "Clojury", but this seems to work:
>
> (defn count-leaves [tree]
> (if (sequential? tree)
> (+ (count-leaves (first tree))
> (count-leaves (rest tree)))
> (or tree 0)))
>
> user> (count-le
I'm not sure if it's "Clojury", but this seems to work:
(defn count-leaves [tree]
(if (sequential? tree)
(+ (count-leaves (first tree))
(count-leaves (rest tree)))
(or tree 0)))
user> (count-leaves [1 2 3])
6
user> (count-leaves [1 [2] 3])
6
user> (count-leaves [])
0
On Feb 15,
Hi,
Trying to convert to clojure but stumbled on it...
(defun count-leaves (tree)
(if (atom tree)
1
(+ (count-leaves (car tree))
(or (if (cdr tree) (count-leaves (cdr tree)))
1
> (count-leaves ’((a b (c d)) (e) f))
10
My clojure version is:
user=> (defn count-leaves
[t
On Feb 15, 7:17 am, bOR_ wrote:
> Getting a bit confused again. It seems possible to make counters from
> agents, atoms and refs
...
> Is there a time and place for all three of them? I am leaning towards
> always using the agent, as it can be send from transactions when the
> transaction finishe
On Sun, Feb 15, 2009 at 9:06 AM, Stuart Halloway
wrote:
>
> Does this clarify the point I was making?
>
> When writing macros, you cannot dynamically build one of the syntactic
> sugar forms. For example, you cannot write a macro that expands cls
> and member into (cls/member):
>
> (defmacr
Hi,
Am 15.02.2009 um 15:27 schrieb Emeka:
Key only accepts a map entry and not a Map object.
Could you explain this further.
When you call seq on a map, you get a sequence of MapEntries.
Each map entry contains a key and the corresponding value.
You can access the key via the key function (
On Feb 15, 2009, at 9:06 AM, Stuart Halloway wrote:
>
> Does this clarify the point I was making?
>
> When writing macros, you cannot dynamically build one of the syntactic
> sugar forms. For example, you cannot write a macro that expands cls
> and member into (cls/member):
>
> (defmacro c
>
>
> Key only accepts a map entry and not a Map object.
>
Could you explain this further.
>
>
>
>> thanks in advance,
>> -sun
>>
>>
>>
>
> >
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post
Yes, and combined with the technique in the link Kevin provided, it's clean
if something goes wrong, java/the os will take care of deleting the temp
file for you :
// Create temp file.
File temp = File.createTempFile(*"pattern"*, *".suffix"*);
// Delete temp file when program exits.
temp.deleteOn
On Feb 14, 11:10 pm, Chouser wrote:
> On Sat, Feb 14, 2009 at 7:19 PM, Stephen C. Gilardi wrote:
>
>
>
> > "set" is a hash set. It will never contain two items with equal hashes.
>
> I don't think that's quite right. I don't think it matters in this
> case, but hash values aren't guaranteed u
Does this clarify the point I was making?
When writing macros, you cannot dynamically build one of the syntactic
sugar forms. For example, you cannot write a macro that expands cls
and member into (cls/member):
(defmacro call-static [cls member] `(~cls/~member))
-> java.lang.Ex
On Feb 15, 12:42 pm, Laurent PETIT wrote:
> Well, so indeed, the temporary file solution seems a good one, then.
The consensus seems to be to use a temporary file, then. I had thought
there might be a flashy cutting-edge way of handling this sort of IO,
but I guess sometimes the best solutions a
Well, so indeed, the temporary file solution seems a good one, then.
--
laurent
2009/2/15 James Reeves
>
> On Feb 14, 10:58 pm, Laurent PETIT wrote:
> > You could maybe solve the read problem by also embedding, in the name of
> the
> > file, its intended content size ?
>
> That solves the rea
On Feb 14, 10:58 pm, Laurent PETIT wrote:
> You could maybe solve the read problem by also embedding, in the name of the
> file, its intended content size ?
That solves the read problem, but not the conflicting write problem.
It also seems harder than using a temporary file.
> If the file is im
Getting a bit confused again. It seems possible to make counters from
agents, atoms and refs
(def countagent (agent 0))
(send agent inc)
(def countatom (atom 0))
(swap! atom inc)
(def countref (ref 0))
(dosync (commute countref inc))
Is there a time and place for all three of them? I am leani
In January Mark Engelberg brought up the subject of certain "missing"
math functions and provided some nice code to fix the situation. [1]
I'm still pretty new to Clojure, and I don't understand all of the
ins and outs of Mark's code, but I've come up with implementations of
a couple of fu
Hi,
Am 15.02.2009 um 03:18 schrieb kyle smith:
I'd like to do something like (map a-macro some-code)
What I can't do is (map #(a-macro %) some-code) because % evals each
code fragment.
1:1 user=> (map (var-get #'declare) [x y z])
((do (def x)) (do (def y)) (do (def z)))
I suppose you want to
On 15.02.2009, at 03:07, kyle smith wrote:
> I'm trying to map across code, but map evals each item in the list.
> I've been trying to re-implement map as a macro, but so far no
> success. Is there some way to accomplish this?
I am not sure I understand 100% what you want to do, but perhaps wha
97 matches
Mail list logo