On Jan 19, 1:05 am, Stuart Sierra the.stuart.sie...@gmail.com wrote:
On Jan 18, 6:56 pm, Anand Patil anand.prabhakar.pa...@gmail.com
wrote:
Would it make any sense to make @ polymorphic so that @x return x's
value when x is a var rather than raising an error?
Actually, it already is:
Hello,
While playing with clojure.contrib.test-is/with-test I realized that I
was unable to use with-test with macros because the form (defmacro foo
[bar]) returns nil and not #'foo.
Please find attached a patch.
Christophe
--~--~-~--~~~---~--~~
You received
I'm trying to make the documentation (still awaiting approval) in the
Learning Clojure WikiBook regarding syntax-quote expansion as
accurate as possible (like in the CL HyperSpec).
I've recently noticed something. In The Reader section of the
Clojure Reference, where it explains syntax-quotes,
Hello,
Is it somehow related to the way Wicket does templating ?
On Jan 19, 11:34 am, Christophe Grand christo...@cgrand.net wrote:
Hello group!
Enlive (http://github.com/cgrand/enlive/tree/master) is a selector based
templating library.
The main design goal was to decouple html and
Being new to Clojure , I started off playing with the codes ,and this
is the result, a 2cents calculator. It is not yet a done deal,
however, my laptop got fried, so I would be redundant for few days,
that's why I' ve decided to 'outsource' :).I invite your comments and
any code that might make
Great job!
Emeka
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
lpetit a écrit :
Hello,
Is it somehow related to the way Wicket does templating ?
After looking at Wicket examples, I say no: Wicket requires the template
author to add namespaced attributes or elements to the html code and
Enlive doesn't try to provide a component system.
Enlive is
Thanks Steve. The code is called by another function that handles the
agent state so no it is not called directly. Here is the additional
code (it is a simple Newbie web server learning project):
Here is how the web server is run:
(ws-run 3000 wh-handler)
The web
On Mon, Jan 19, 2009 at 4:07 AM, Anand Patil
anand.prabhakar.pa...@gmail.com wrote:
Sorry, I was not being clear. Why not just let (deref 5) return 5? I
would consider that syntactic sugar, as it would make it easier to
deref a mixed vector of refs, constants, agents and atoms without
Many macro characters and reader forms have equivalent functions.
For example, (set ...) is the same as #{...} and (quote form) is the
same as 'form.
What are the equivalent functions, if any, for these?
\ - character literal
#... - regular expression - re-pattern?
#^ - metadata
#' - var-quote
This might be helpful:
http://os-lists.sun.com/thread.jspa?messageID=457986
--~--~-~--~~~---~--~~
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
To unsubscribe
On Jan 19, 1:25 pm, Chouser chou...@gmail.com wrote:
On Mon, Jan 19, 2009 at 4:07 AM, Anand Patil
anand.prabhakar.pa...@gmail.com wrote:
Sorry, I was not being clear. Why not just let (deref 5) return 5? I
would consider that syntactic sugar, as it would make it easier to
deref a mixed
In case this is of use to anybody else, I thought I'd share my version
of a socket REPL: http://clojure.googlegroups.com/web/socket-repl.clj
Unlike the socket repl on the Wiki Example page, it does the
following:
- uses the repl from clojure.main
- keeps track of connections, closing the
On Jan 19, 2009, at 9:38 AM, Craig McDaniel wrote:
In case this is of use to anybody else, I thought I'd share my version
of a socket REPL: http://clojure.googlegroups.com/web/socket-repl.clj
Unlike the socket repl on the Wiki Example page, it does the
following:
- uses the repl from
Correction: http://clojure.googlegroups.com/web/socket-repl+(2).clj
--~--~-~--~~~---~--~~
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
To unsubscribe from
On Jan 19, 9:55 am, Stephen C. Gilardi squee...@mac.com wrote:
Would you be up for including this in clojure-contrib? If so, and if
we hear no objection here, could you please put on the appropriate EPL
license header and your copyright notice (see other contribs for
examples) and I'll
Well, somehow that link points to an old version. I guess the delete
and rename functions in Google groups do some strange things. Just
look for the file in the Files section.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
On Jan 19, 9:55 am, Stephen C. Gilardi squee...@mac.com wrote:
On Jan 19, 2009, at 9:38 AM, Craig McDaniel wrote:
In case this is of use to anybody else, I thought I'd share my version
of a socket REPL:http://clojure.googlegroups.com/web/socket-repl.clj
Unlike the socket repl on the
The multiple syntax-quote and unqote behavior above seems to work in Clojure
just fine and like CL as well.
On Mon, Jan 19, 2009 at 5:58 AM, Rock rocco.ro...@gmail.com wrote:
I'm trying to make the documentation (still awaiting approval) in the
Learning Clojure WikiBook regarding syntax-quote
On Fri, Jan 16, 2009 at 9:57 PM, David Nolen dnolen.li...@gmail.com wrote:
Just made sense to me today as well.
#^Class
is short form for saying set the metadata for the symbol being defined (in
this case list) to the map {:tag Class}.
#^ is a reader macro for setting metadata for the
I am a registered contributor...even though I haven't contributed
anything so far. I opened an issue on clojure-contrib and attached the
file. Let me know if that is not the correct procedure.
-Craig
--~--~-~--~~~---~--~~
You received this message because you are
On Jan 19, 4:57 pm, David Nolen dnolen.li...@gmail.com wrote:
The multiple syntax-quote and unqote behavior above seems to work in Clojure
just fine and like CL as well.
Thanks. That's what I'm hoping for. The technique Graham illustrates
in ACL is very helpful. Its value is in the fact that
On Jan 19, 2009, at 10:59 AM, Stephen C. Gilardi wrote:
On Jan 19, 2009, at 10:45 AM, Rich Hickey wrote:
It's very important to follow the protocol that patches only come
from
registered contributors and are posted *by them* as patches through
the issue system. Only in that way is
Stephen C. Gilardi squee...@mac.com writes:
That looks really nice, Craig. I see you're a registered
contributor. Would you be up for including this in clojure-contrib?
I noticed that very little of this code is specific to the REPL; the
bulk of it is just dealing with creating and doing
On Sat, Jan 17, 2009 at 8:03 PM, pc peng2che...@yahoo.com wrote:
This is very useful. For me it was useful to be able to limit the
output to lines that contained a few selected letters.
(show String pper)
=== public final java.lang.String ===
[82] toUpperCase : String ()
[83]
On Mon, Jan 19, 2009 at 11:59 AM, Chouser chou...@gmail.com wrote:
On Sat, Jan 17, 2009 at 8:03 PM, pc peng2che...@yahoo.com wrote:
This is very useful. For me it was useful to be able to limit the
output to lines that contained a few selected letters.
(show String pper)
=== public final
On Mon, Jan 19, 2009 at 9:10 AM, Mark Volkmann
r.mark.volkm...@gmail.com wrote:
What are the equivalent functions, if any, for these?
\ - character literal
I came up with a couple options:
((into {} (map (comp vec reverse) char-name-string)) newline)
(read-string \\newline)
#... - regular
On Mon, Jan 19, 2009 at 11:03 AM, Michael Reid kid.me...@gmail.com wrote:
(defn index-of [#^String s #^String substr]
(.indexOf s substr))
Then the compiler will generate an optimized code path that directly
invokes String.indexOf(String,String), and the other which will fall
back to
On Sat, Jan 17, 2009 at 8:25 PM, Dan Larkin d...@danlarkin.org wrote:
On Jan 17, 2009, at 6:29 PM, Stephen C. Gilardi wrote:
Hi Dan,
That's interesting. I've given it some thought and I've come to see
it as a version of resolve that tries harder than the default.
Here's an implementation
On Jan 18, 11:48 am, wubbie sunj...@gmail.com wrote:
Hi,
Just tried a piece of code from here...
(defn my-deref [x]
(if (or (isa? clojure.lang.Ref (class x))
(isa? clojure.lang.Agent (class x))
(isa? clojure.lang.Atom (class x)))
@x
x))
On Jan 19, 11:59 am, Chouser chou...@gmail.com wrote:
But my version also only allows matches on the method name (not on
return value or argument class names). At first I thought this was
also good, but now I'm less sure. How often do you think you'd want
to be able to search on a method's
On Mon, Jan 19, 2009 at 12:24 PM, Chouser chou...@gmail.com wrote:
#^ - metadata
#^ adds metadata at read-time, so there's no way for a function to do
exactly the same thing, though 'with-meta' does something similar at
runtime.
I've noticed this as well. It seems to me that this
Very interesting, Christophe. I've been playing with StringTemplate
http://www.stringtemplate.org/ lately, but this separates design
from code even further. Can it do conditionals, as in if this
variable is true, includes this HTML element?
-Stuart Sierra
On Jan 19, 5:34 am, Christophe Grand
Thanks Stuart for the with-test macro. It will make my life much
easier. I have been putting my tests in the :test metadata and running
them with (run-tests). The with-tests macro will make it much more
readable. I was also having problems with old test metadata hanging
around.
I am all in favor
On Jan 19, 12:47 pm, Michael Reid kid.me...@gmail.com wrote:
Interesting, I did not know this. But this seems to remove some
flexibility in allowing for duck typing.
Yes, that's a disadvantage with duck typing in most dynamic languages
-- types have to be resolved at run-time. In the case of
Hi,
Am 19.01.2009 um 19:15 schrieb David Nolen:
I've noticed this as well. It seems to me that this prevents you
from dynamically defining a var (like in a macro) that has metadata
attached to it or it's arguments (if it's a function). Is there no
way around how the reader works? Can
Hi James,
On Jan 18, 4:03 pm, James Reeves weavejes...@googlemail.com wrote:
1. I don't like the idea of putting tests next to the functions
they're testing.
That's cool with me, I won't force you to do it one way or the other.
2. Test should come with a description of what scenario they
Thanks for the comments, Luke, glad we're thinking along the same
lines!
-Stuart Sierra
On Jan 19, 1:24 pm, Luke Amdor luke.am...@gmail.com wrote:
Thanks Stuart for the with-test macro. It will make my life much
easier. I have been putting my tests in the :test metadata and running
them with
On Jan 19, 1:15 pm, David Nolen dnolen.li...@gmail.com wrote:
I've noticed this as well. It seems to me that this prevents you from
dynamically defining a var (like in a macro) that has metadata attached to
it or it's arguments (if it's a function).
You can also use the new alter-meta!
Seems like is/are are somewhat gratuitous. Why not leave them out
completely in a deftest, and get the syntax as minimalist as possible?
(deftest test-plus
(= (+ 1 1) 2)
(= (+ 2 3) 5))
--~--~-~--~~~---~--~~
You received this message because you are
With the latest from svn, I'm seeing the following weird behavior.
(def r (ref :old))
(let [old-value @r]
(try
(dosync (ref-set r :new))
(finally
(dosync (ref-set r old-value))
)))
(println @r is @r)
This prints @r is nil whereas I'd expect it to print @r is :old.
But the
Wow, nice!
On Mon, Jan 19, 2009 at 1:47 PM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:
On Jan 19, 1:15 pm, David Nolen dnolen.li...@gmail.com wrote:
I've noticed this as well. It seems to me that this prevents you from
dynamically defining a var (like in a macro) that has metadata
Excellent!
The getScrollableTracksViewportWidth() trick did it :)
On Mon, Jan 19, 2009 at 3:26 PM, MikeM michael.messini...@invista.com wrote:
This might be helpful:
http://os-lists.sun.com/thread.jspa?messageID=457986
--
Venlig hilsen / Kind regards,
Christian Vest Hansen.
On Mon, Jan 19, 2009 at 1:44 PM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
I've attempted to allow for this with the are macro, which takes a
template expression and applies it to a collection of values. The
interface is a little tricky though, so I'm not sure if I should keep
it or
On Jan 19, 11:45 am, Phil Hagelberg p...@hagelb.org wrote:
I noticed that very little of this code is specific to the REPL; the
bulk of it is just dealing with creating and doing things with server
sockets. Perhaps it could be included in clojure-contrib as a
generalized server-sockets
Stuart Sierra a écrit :
Very interesting, Christophe. I've been playing with StringTemplate
http://www.stringtemplate.org/ lately, but this separates design
from code even further. Can it do conditionals, as in if this
variable is true, includes this HTML element
In the only example, I use
On Jan 18, 8:48 am, e evier...@gmail.com wrote:
That's a great argument. I need arguments like these. I work with people
who dismiss JVM. Even though there are many non-Sun JVM's, folks say, Sun
is dead - java is dead - jvm is dead. . even though Java is the most
popular language right
On Jan 19, 6:24 pm, Luke Amdor luke.am...@gmail.com wrote:
I also think that if your test needs a description of what it's doing,
then that's a smell. It's an excuse for easily readable code and I
think we can all agree that we should try to make our code as easily
readable as possible.
The
On Jan 19, 6:44 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:
1. I don't like the idea of putting tests next to the functions
they're testing.
That's cool with me, I won't force you to do it one way or the other.
And here I was ready to start a holy crusade against you ;)
Honestly,
On Jan 19, 8:12 pm, .Bill Smith william.m.sm...@gmail.com wrote:
Would you mind elaborating on that point? At a previous job, I worked
on a corporate banking application that had numerous configuration
settings. Thousands of companies used the application. It was
impractical to test the
I'm not sure there's much to elaborate on. It's a problem, and one I
haven't solved, but I have some ideas. Ideally, I'd like to be able to
write something like:
(defn rnd-valid-name []
(rnd-str [A-Za-z][A-Za-z0-9_]*)
(defn rnd-user []
{:uid (rnd-int 1 100)
:name
On Jan 19, 2:18 pm, Christophe Grand christo...@cgrand.net wrote:
In the only example, I use 'when-not to conditionally display an element.
Got it, I didn't recognize at first what html/show was doing.
-S
--~--~-~--~~~---~--~~
You received this message because
On Jan 19, 2009, at 2:15 PM, Craig McDaniel wrote:
Thanks, that's a good point. I'm posting a new file server-socket.clj
that is more generic and includes the REPL as an example case.
I checked in server_socket.clj - thanks!
--Steve
smime.p7s
Description: S/MIME cryptographic signature
Stuart Sierra wrote:
Very interesting, Christophe. I've been playing with StringTemplate
http://www.stringtemplate.org/ lately, but this separates design
from code even further. Can it do conditionals, as in if this
variable is true, includes this HTML element?
...and the following posts
On Jan 19, 12:34 pm, Chouser chou...@gmail.com wrote:
If you remove the #^String type hint, you'll see that both String and
StringBuffer work fine.
In this specific case, one would use CharSequence, an interface both
String and StringBuffer implement.
I've been doing some OO-type Clojure programming, and have run into
the following (quite minor) annoyance:
I've defined a struct with a :class of ::Foo in namespace
my.long.namespace.foo.
In another namespace my.long.namespace.bar, I want to define a
subclass of this struct.
In this namespace,
That's a solid arg, too . . . but it would be stronger if we weren't
importing things from java all the time. If we said like, (gui-frame
hello), which happened to be implemented as a JFrame . . . then that'd be
even stronger. Drop in a different REPL and you'd still get a JFrame-like
thing even
can someone explain to a newby like me what we are talking about here? :)
This is totally over my head. Only do so if you think it's a valuable
lesson to be had. Otherwise, I fully accept that if I don't get it, then
I'm not the intended audience.
Thanks.
On Mon, Jan 19, 2009 at 2:23 PM, Dan
Hello friends,
I would like to announce a super-pre-alpha release of Dejcartes, a
Clojure wrapper around the JFreeChart charting library. From the readme:
Dejcartes is a Clojure interface to the JFreeChart charting and graphing
library. A simple interface to be sure, but practical for
Works. amazing.
On Mon, Jan 19, 2009 at 4:51 PM, David Nolen dnolen.li...@gmail.com wrote:
Actually, so this can't be used on structs for fns?
On Mon, Jan 19, 2009 at 1:47 PM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
On Jan 19, 1:15 pm, David Nolen dnolen.li...@gmail.com wrote:
My OO example from earlier deals with this case by completely removing any
need to manually derive tags. This is done by having CLJOS keep it's own
internal hierarchy (via make-hierarchy) rather than using the default one.
By modifying metadata on the vars holding structs created by defclass
Hi all. Is this a bug or a feature? When I bind the var *num* to a new
value, in one case it appears the lambda uses the original value, not
the newly bound one.
(def *num* 16)
(defn f1 []
( map (fn [x] *num* ) [1]))
(defn f2 [] ;; same as f1 but calls first on the map
(first
(
Lazy evaluation is a harsh mistress.
user= (def b1 (binding [*num* 1024] (f1)))
#'user/b1
user= (def b2 (binding [*num* 1024] (f1)))
#'user/b2
user= b1
(16)
user= b2
(16)
The difference between the example above and your example is the
interaction with the REPL. Your f1 is lazy, and is not
On the subject of per defmulti hierarchies:
The recent CLJOS thread got me thinking about this problem again.
While allowing per-multimethod hierarchies solves a large number
problems, I think it might be lacking for a class of needs. I think I
have solution that can provide for multiple
Hi Emeka,
On Jan 19, 11:17 pm, janus emekami...@gmail.com wrote:
that's why I' ve decided to 'outsource' :).I invite your comments and
any code that might make this toy to worth 2 cents in today's market.
Reducing the amount of repetition :)
Just wondering if this behavior is by design:
(Math/min 0 0.2)
java.lang.IllegalArgumentException: No matching method found: min
(NO_SOURCE_FILE:0)
(Math/min 0.0 0.2)
0.0
Coming from Java, it just stuck out to me, since Java has automatic
upcasting.
Thanks
-Patrick
Hi
On Tue, Jan 20, 2009 at 7:01 AM, Stuart Halloway
stuart.hallo...@gmail.com wrote:
Lazy evaluation is a harsh mistress.
user= (def b1 (binding [*num* 1024] (f1)))
#'user/b1
user= (def b2 (binding [*num* 1024] (f1)))
#'user/b2
Did you mean b1 and b2 to have the same definition? If so,
While it doesn't answer your more general question, just pointing out
there is a Clojure min:
user= (min 0 0.2)
0
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to
How would one go about fixing f1 (or b1)?
Depends what you want to achieve... here are two possible 'fixes':
; don't use lazy evaluation
(defn f1 []
(doall (map (fn [x] *num* ) [1])))
; use lazy evaluation, but preserve the binding when the lazy sequence
is created
(defn f1 []
(let
69 matches
Mail list logo