On Feb 15, 12:42 pm, Laurent PETIT laurent.pe...@gmail.com 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
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))
-
On Feb 14, 11:10 pm, Chouser chou...@gmail.com wrote:
On Sat, Feb 14, 2009 at 7:19 PM, Stephen C. Gilardi squee...@mac.com 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
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.
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 represent
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=gstq=sorted-set#51ede18b2fd7ab96
Therefore things like (sort
On Sat, Feb 14, 2009 at 5:44 PM, James Reeves weavejes...@googlemail.comwrote:
On Feb 14, 5:30 pm, Dan redalas...@gmail.com 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
On Sun, Feb 15, 2009 at 12:31 PM, Mark Volkmann
r.mark.volkm...@gmail.com 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
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
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
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
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
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
On Feb 15, 4:30 pm, Stephen C. Gilardi squee...@mac.com 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
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 Sun, Feb 15, 2009 at 4:30 PM, Stephen C. Gilardi squee...@mac.com 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
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 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: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 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
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]
(loop
On Feb 15, 2009, at 5:01 PM, Mark Engelberg wrote:
On Sun, Feb 15, 2009 at 1:44 PM, Chouser chou...@gmail.com 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 Sun, Feb 15, 2009 at 5:03 PM, Stephen C. Gilardi squee...@mac.com 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
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 example of
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.
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
(next x)
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.
On
How about next-seq or rest-seq?
On Sun, Feb 15, 2009 at 3:34 PM, James G. Sack (jim) jgs...@san.rr.com 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
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:
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.
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 and Seq
(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 rbysam...@gmail.com 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
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 dnolen.li...@gmail.com wrote:
(map (fn [ rest] (apply vector rest)) [1 2 3] ['a 'b 'c] [cat dog
Thanks a lot. I didn't know that map could take multiple collections.
On Feb 15, 5:47 pm, David Nolen dnolen.li...@gmail.com 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,
On Feb 15, 6:34 pm, James G. Sack (jim) jgs...@san.rr.com 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,
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
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 subtle
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
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
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) (:a2
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 OP wanted a
On Sun, Feb 15, 2009 at 10:50 PM, David Nolen dnolen.li...@gmail.com 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
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,
On Sun, Feb 15, 2009 at 10:06 PM, David Nolen dnolen.li...@gmail.com 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
On Feb 15, 2:44 pm, timc timgcl...@gmail.com 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]))
On Feb 15, 11:46 pm, Feng hou...@gmail.com 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
(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 Sun, Feb 15, 2009 at 6:44 PM, Rich Hickey richhic...@gmail.com 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
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?).
On Mon, Feb 16, 2009 at 12:25 AM, David Nolen dnolen.li...@gmail.com 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
On Wed, Jan 28, 2009 at 6:17 PM, Peter Wolf opus...@gmail.com 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
On Thu, Feb 5, 2009 at 2:59 PM, Nathan Cunningham penguin2...@gmail.com 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#
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 bring the
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.
54 matches
Mail list logo