Do you think it would be useful to add the ability to append to a
file?
On Mar 28, 9:36 pm, Stuart Sierra wrote:
> Following a discussion from a few days ago, I've added two new macros
> to clojure.contrib.duck-streams:
>
> (defmacro with-out-writer
> "Opens a writer on f, binds it to *out*, a
On Sun, Mar 29, 2009 at 1:25 AM, mikel wrote:
>
> (type (proxy [clojure.lang.IMeta clojure.lang.IRef][]))
>
> java.lang.UnsupportedOperationException: meta (NO_SOURCE_FILE:0)
> [Thrown class clojure.lang.Compiler$CompilerException]
>
>
> No doubt someone is going to point out that the proxy objec
On Mar 28, 4:28 pm, David Nolen wrote:
> On Sat, Mar 28, 2009 at 4:40 PM, mikel wrote:
>
> > So, at minimum, to make a solid port, you need to add a function that
> > can return a sensible type value for any input
>
> Enjoying the thread. Out of curiosity for which Clojure values is the return
On Mar 29, 7:36 am, Stuart Sierra wrote:
> Following a discussion from a few days ago, I've added two new macros
> to clojure.contrib.duck-streams:
>
> (defmacro with-out-writer
> "Opens a writer on f, binds it to *out*, and evalutes body."
> [f & body]
> `(with-open [stream# (writer ~f)]
2009/3/29 Stephen C. Gilardi
>
> On Mar 28, 2009, at 10:31 PM, Glen Stampoultzis wrote:
>
> It wasn't really this specific problem that I wanted to point out but more
>> to trigger a rethink of how errors are reported back to the user.
>>
>
> I understand, but without specifying which Clojure yo
Hi folks,
New lib in contrib: "with-ns" -- a library to temporarily switch
namespaces at run-time. People request this occasionally, and I
finally came up with a way to do it. The code is sneaky, and it
relies on "eval", but it works. Here's the doc:
clojure.contrib.with-ns/with-ns
([ns & bod
On Mar 28, 2009, at 10:31 PM, Glen Stampoultzis wrote:
It wasn't really this specific problem that I wanted to point out
but more to trigger a rethink of how errors are reported back to the
user.
I understand, but without specifying which Clojure you're using and
giving an example of how
Following a discussion from a few days ago, I've added two new macros
to clojure.contrib.duck-streams:
(defmacro with-out-writer
"Opens a writer on f, binds it to *out*, and evalutes body."
[f & body]
`(with-open [stream# (writer ~f)]
(binding [*out* stream#]
~...@body)))
(defm
very cool :)
On 3/28/09, Stuart Sierra wrote:
>
> Hi folks,
> I finally came up with fixtures for clojure.contrib.test-is. Now you
> can do before/after setup for each test case. Here's the
> documentation, let me know what you think.
> -Stuart Sierra
>
> ;; FIXTURES (new)
> ;;
> ;; Fixt
It wasn't really this specific problem that I wanted to point out but more
to trigger a rethink of how errors are reported back to the user.
Here's an example that gives an error somewhat similar to the one I posted:
(defn testing [a b] (print a b))
(testing)
java.lang.NoSuchMethodError:
java.lan
Hi folks,
I finally came up with fixtures for clojure.contrib.test-is. Now you
can do before/after setup for each test case. Here's the
documentation, let me know what you think.
-Stuart Sierra
;; FIXTURES (new)
;;
;; Fixtures allow you to run code before and after tests, to set up
;; t
Here's a quickly hacked together solution (code golf welcome), I'm using
special variables so that we don't affect what other multimethods see:
(def *super* nil)
(defmacro super [afn obj & args]
(let [fn-key (keyword (str afn))]
`(binding [*super* {~fn-key (or (and (~fn-key *super*)
(fi
On Mar 28, 5:05 pm, billh04 wrote:
> I have been thinking of doing the following to catch misspellings:
>
> (def -north- :north)
> (def -south- :south)
Nothing wrong with that, but it still doesn't prevent you from using
the keywords elsewhere. You probably want to add assertions and
valida
On Mar 28, 7:55 pm, Glen Stampoultzis wrote:
> I recently got this one that left me scratching my head:
>
> java.lang.NullPointerException (splat.clj:0)
> at clojure.lang.Compiler.eval(Compiler.java:4533)
In my experience, an error at line 0 means something wrong with the
(ns...) call at
On Mar 28, 2009, at 8:01 PM, Glen Stampoultzis wrote:
Sorry I just realized I was a bit ambiguous with this. The
exception does show the line number (in the second stack trace).
But it's gone missing in the top one.
Is this with the current svn or most recent release of Clojure? It
wou
Sorry I just realized I was a bit ambiguous with this. The exception does
show the line number (in the second stack trace). But it's gone missing in
the top one.
2009/3/29 Glen Stampoultzis
> Hi, I've been really enjoying getting to know clojure. It's an awesome
> language that has got me ver
Hi, I've been really enjoying getting to know clojure. It's an awesome
language that has got me very interested in learning more. One thing that
hasn't left me impressed is the error reporting.
I recently got this one that left me scratching my head:
java.lang.NullPointerException (splat.clj:0)
Having thought a little about multiple inheritance when implementing Spinoza
I also ran into this problem. However at the time I wasn't hindered by
multifn dispatch as much as the fact that parents cannot be ordered (because
calling parents on a tag returns a set) as pointed out by Mark. I understa
something like this came up on irc the other day. this is a good
opportunity for someone to write some macros that allow you to
specify a validator function for structs similar to refs and agents.
On Sat, Mar 28, 2009 at 2:20 PM, mikel wrote:
>
>
>
> On Mar 28, 4:05 pm, billh04 wrote:
>> I am
On Sat, Mar 28, 2009 at 4:40 PM, mikel wrote:
>
> So, at minimum, to make a solid port, you need to add a function that
> can return a sensible type value for any input
Enjoying the thread. Out of curiosity for which Clojure values is the return
value of the type function undefined?
David
--~
On Mar 28, 4:05 pm, billh04 wrote:
> I am using keywords as constants in my clojure programs, but I am
> worried about misspelling them. For example, I am writing a game and I
> am using the keywords :north and :south to indicate objects that
> belong to the north player or the south player. Wi
I am using keywords as constants in my clojure programs, but I am
worried about misspelling them. For example, I am writing a game and I
am using the keywords :north and :south to indicate objects that
belong to the north player or the south player. With this, I can
define how to create the pieces
On Mar 28, 4:22 am, Michael Wood wrote:
> On Thu, Mar 26, 2009 at 12:49 PM, Marko Kocić wrote:
>
> > On 25 мар, 21:41, mikel wrote:
> >> Tinyclos is decent, and lots of people have made good use of it. For
> >> example, it's a "standard" extension to Chicken Scheme (insofar as
> >> anything t
Your analysis is correct. Note that adding a doall fixes the problem
user=> (def tl (reduce #(doall (concat %1 [%2])) [] (range 4000)))
#'user/tl
user=> (last tl)
3999
efficiency notwithstanding.
On Mar 28, 8:59 am, jim wrote:
> Hey Rich,
>
> I found an interesting way to blow up the stack.
>
On Mar 28, 1:59 pm, "ke...@ksvanhorn.com"
wrote:
> I'm in the process of learning Clojure, and I ran across something
> that other newbies like me may find useful. The question I had was
> this: how does one get a method name into a macro? Consider the
> following code:
>
> (defmacro foo [x
Another way to handle it would be to use the alternate syntax for
static methods:
(defmacro foo [x] `(Character/isWhitespace ~x))
which would expand properly. Using the dot form for instance methods,
i.e. (.method obj) should also keep syntax quote from expanding it
improperly.
On Mar 28, 12:5
Your solution is the accepted one ;)
On Sat, Mar 28, 2009 at 1:59 PM, ke...@ksvanhorn.com wrote:
>
> I'm in the process of learning Clojure, and I ran across something
> that other newbies like me may find useful. The question I had was
> this: how does one get a method name into a macro? Cons
I'm in the process of learning Clojure, and I ran across something
that other newbies like me may find useful. The question I had was
this: how does one get a method name into a macro? Consider the
following code:
(defmacro foo [x] `(. Character (isWhitespace ~x)))
Yes, I know that this woul
Yesterday a coworker need a few excel spreadsheets (tab delimited)
stitched together. I took this as an opportunity to test run my
proposed string functions. Here's what I found:
Good stuff
* Having re-split be lazy is awesome. This made partially traversing
a row super quick.
* The str-before
Hey Rich,
I found an interesting way to blow up the stack.
user=> (def tl (reduce #(concat %1 [%2]) [] (range 3500)))
#'user/tl
user=> (last tl)
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
The 3500 is probably specific to my environment. I'm assuming that
all the concats get deferred until
On 27.03.2009, at 22:25, srader wrote:
> Thanks for the explanation and the patch. But instead of patching
> print-method, maybe vary-meta should be patched to handle refs?
That doesn't make sense to me. vary-meta takes a value object and
returns another value object with identical value but d
On Sat, Mar 28, 2009 at 2:32 AM, Victor Rodriguez wrote:
>
> On Fri, Mar 27, 2009 at 5:51 PM, ke...@ksvanhorn.com
> wrote:
>>
>> The Clojure documentation, under "Reader", gives a list of characters
>> allowed in a symbol name. The characters, <, >, and = are not
>> included in this list. How
On Thu, Mar 26, 2009 at 12:49 PM, Marko Kocić wrote:
>
> On 25 мар, 21:41, mikel wrote:
>> Tinyclos is decent, and lots of people have made good use of it. For
>> example, it's a "standard" extension to Chicken Scheme (insofar as
>> anything to do with Chicken Scheme can be called "standard") an
33 matches
Mail list logo