The Clojure wikibook has an example implementation of a Repl over a
socket
(http://en.wikibooks.org/wiki/Clojure_Programming#Simple_REPL_on_a_Socket).
I wonder how to solve the problem of showing output if somewhere in
the evaluated expression, a new thread is created that will eventually
print so
Hi, I am a Clojure beginner, but I am definitely staying for more! I
heard about Clojure when Guy Steele mentioned it (just as a subtle
remark) in a talk about Fortress at JAOO 2008. Thought that when he
mentions it, it will probably be worth taking a look ;-)
WOW. I've just seen the web present
On Sep 22, 4:36 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote:
> I was surprised that clojure/binding doesn't support destructuring bind:
>
> Clojure
> user=> (def a)
> #'user/a
> user=> (def b)
> #'user/b
> user=> (binding [[a b] [1 2]] (+ a b))
Hello Stephen.
I am not sure I understand.
The Clojure wikibook has an example implementation of a Repl over a
socket
(http://en.wikibooks.org/wiki/Clojure_Programming#Simple_REPL_on_a_Socket). I
wonder how to solve the problem of showing output if somewhere in the evaluated
expression, a new thread is created that will eventually print
On Oct 9, 2008, at 3:13 AM, Krukow wrote:
> Hello Stephen.
>
> I am not sure I understand. Your example doesn't seem to suggest that
> you are really needing a form of destructuring. Rather, it looks like
> multiple bindings. Presently, I can do:
>
> krukow:~/languages/clojure/trunk$ cl
> Clojur
Mike,
I also posted the Queston at stackoverflow.com.
There are a number of people whom would be interested in hearing your
answer.
Is it alright if I place a copy of your answer there and cite you?
I don't suppose you have joined yourself have you?
http://stackoverflow.com/questions/181842/tran
Sorry for the noise. Google Mail seemed to not send my messages. Hence
the triple posting.
--~--~-~--~~~---~--~~
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
The Clojure wikibook has an example implementation of a Repl over a
socket (http://en.wikibooks.org/wiki/
Clojure_Programming#Simple_REPL_on_a_Socket). I wonder how to solve
the problem of showing output if somewhere in the evaluated
expression, a new thread is created that will eventually print
s
On Oct 9, 8:35 am, mb <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On 9 Okt., 08:39, Krukow <[EMAIL PROTECTED]> wrote:
>
> > (str x " loves " y))
>
> > Now the question is why is it logging 5 times? Is this a bug, or has
> > something fundamental changed? I checked out Clojure from SVN a few
> > days
Hello,
On 9 Okt., 02:41, Jonas Bengtsson <[EMAIL PROTECTED]> wrote:
> It almost works now, however something fishy is going on when it tries
> to launch screen from vim. I've done the following setting:
Do you also use the VimClojure plugin? Chimp heavily relies on its
syntax highlighting. Of cou
Hello,
On 9 Okt., 06:41, Mitch <[EMAIL PROTECTED]> wrote:
> I've been using chimp a little bit, and it works pretty well except
> for the \ef command. It gives me the following error:
> E119: Not enough arguments for function: 31_EvalFile
Please report such issues! Otherwise they can't be fixed.
Hi,
On 9 Okt., 08:39, Krukow <[EMAIL PROTECTED]> wrote:
> (str x " loves " y))
>
> Now the question is why is it logging 5 times? Is this a bug, or has
> something fundamental changed? I checked out Clojure from SVN a few
> days ago.
Have a look at the implementation of str in boot.clj:
...
Thanks for your help.
(vec (replicate 1 0)) is much better than what I had before.
--~--~-~--~~~---~--~~
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
Hi, I'm trying to wrap my head around functional programming, and I'm
having some trouble doing the following:
Here's a small iterator function that I wrote, which calls a function
on each element of a vector-of-vectors.
(defn v2d-each
([v2d stRow endRow stCol endCol func]
(doseq r (range
On Thu, Oct 9, 2008 at 10:57 AM, CuppoJava <[EMAIL PROTECTED]> wrote:
>
> Hi, I'm trying to wrap my head around functional programming, and I'm
> having some trouble doing the following:
>
> Here's a small iterator function that I wrote, which calls a function
> on each element of a vector-of-vect
Hi everyone,
I may look stupid but how do you cast Java arguments ?
(java.sql.DriverManager/registerDriver (clojure.lang.RT/classForName
"com.mysql.jdbc.Driver"))
java.lang.ClassCastException: java.lang.Class cannot be cast to
java.sql.Driver (NO_SOURCE_FILE:0)
I fully agree with the error mes
Yes, dealing with multiple escaped escape sequences is a weak point of
handling regexs. To really integrate them into the language, and that
integration is essential to success, they must be typed straight into
the code literally without baggage.
As much as flexibility and simplicity, the easy a
On Oct 9, 6:11 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote:
> On Oct 8, 2008, at 6:19 PM, Michael Beauregard wrote:
>
> Possibly of interest for the layout part of that, I recently checked
> in clojure.contrib.miglayout which provides support for using
> MiGLayout (http://miglayout.co
On Thu, Oct 9, 2008 at 12:06 PM, Luc Prefontaine
<[EMAIL PROTECTED]> wrote:
>
> I may look stupid but how do you cast Java arguments ?
user=> (doc cast)
-
clojure/cast
([c x])
Throws a ClassCastException if x is not a c, else returns x.
nil
So, (cast java.sql.Driver you
On Oct 9, 2008, at 12:06 PM, Luc Prefontaine wrote:
> Hi everyone,
>
> I may look stupid but how do you cast Java arguments ?
>
> (java.sql.DriverManager/registerDriver (clojure.lang.RT/classForName
> "com.mysql.jdbc.Driver"))
> java.lang.ClassCastException: java.lang.Class cannot be cast to
On Oct 8, 2008, at 11:03 AM, Chouser wrote:
> Of course if this change is unacceptable, these proposed rules could
> be applied to a new dispatch macro. One option would be something
> like #r/foo/ that would allow your choice of delimiters to further
> reduce the need for back-slash quoting wit
What about having #"pattern" work like is does now, and then having #/
pattern/ work similarly to Ruby, Python, Perl, etc. regular expression
in that they not require double escaping of characters like '\'? So
in other words:
#/(.*?)<\/em>/
instead of:
#"(.*?)<\\/em>"
The advantage to
Hi Luc,
You are trying to use a class where an instance of the class is
expected. You will need to .newInstance or equivalent.
Stuart
> Hi everyone,
>
> I may look stupid but how do you cast Java arguments ?
>
> (java.sql.DriverManager/registerDriver (clojure.lang.RT/classForName
> "com.mys
Here's another variant of the "classes are not first class objects in
Java" problem:
user=> (new String)
""
user=> (new (Class/forName "java.lang.String"))
java.lang.IllegalArgumentException: Unable to resolve classname:
[EMAIL PROTECTED]
I understand why this fails, and that it is consisten
Here is a little test :
(def *indent* 0)
(defmacro with-indent [& body]
`(binding [*indent* (+ *indent* 1)]
[EMAIL PROTECTED]))
=> (with-indent (print *indent*) (lazy-cons *indent* (cons *indent*
nil)))
1(0 0)
I somehow expected to have the special variable value lexically bound
at eval
On Thu, Oct 9, 2008 at 2:03 PM, Paul Barry <[EMAIL PROTECTED]> wrote:
>
> What about having #"pattern" work like is does now, and then having #/
> pattern/ work similarly to Ruby, Python, Perl, etc. regular expression
> in that they not require double escaping of characters like '\'? So
> in othe
Sacha,
You can to force evaluation of *indent* while preserving the lazyness
of the code that uses *indent*:
(with-indent
(print *indent*)
(let [ind *indent*]
(lazy-cons ind (cons ind nil
If this idiom is useful often enough there could be a macro for it. Or
maybe there alrea
On Oct 9, 2:30 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> Here's another variant of the "classes are not first class objects in
> Java" problem:
>
> user=> (new String)
> ""
> user=> (new (Class/forName "java.lang.String"))
> java.lang.IllegalArgumentException: Unable to resolve classname:
On Oct 9, 2:44 pm, Chouser <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 9, 2008 at 2:03 PM, Paul Barry <[EMAIL PROTECTED]> wrote:
>
> > What about having #"pattern" work like is does now, and then having #/
> > pattern/ work similarly to Ruby, Python, Perl, etc. regular expression
> > in that they n
On Oct 8, 9:54 am, Martin DeMello <[EMAIL PROTECTED]> wrote:
> That was my first thought, but I was hoping there was a library for
> this already. It seems to be a surprisingly uncommon use case (not
> just in clojure, I've ended up implementing something like that in
> several languages) - I'd ha
On Thu, 2008-10-09 at 02:30 -0700, [EMAIL PROTECTED] wrote:
> As bindings are not inherited by new threads, how can this be done
> without actually changing the expressions that are evaluated?
>
> I know that in March it was briefly discussed, but wouldn't it be
> useful to have a binding variant
On Thu, 2008-10-09 at 22:06 +0200, ntupel wrote:
> After further investigation and experimentation with macros I finally
> managed to trigger a NullpointerException:
>
> user=> (defmacro on-thread [env exp] `(doto (new Thread #(binding ~env
> (~exp))) (start)))
Ignore me. That's like doing ((pr
I think it will be far better to model any Clojure GUI libraries on
JavaFX rather than straight Swing. In fact, some code samples people
have posted here remind me of JavaFX code.
Don Sym, of F# develops his programs on the command line,
instantiating GUIs along the way to peek inside data struc
Clojure is still beta-ish, no? I say either go with the breakage, or use the
#r"" without the user chosen delimiters.
The extra backquoting was admittedly a surprise for me at first. It seemed
awkward, and unexpected, so if some breakage occurs, then I think its
warranted. If breakage is a problem
I found a workaround...
I was able to register the driver using
-Djdbc.drivers=com.mysql.jdbc.Driver on the java command line.
Looks like loading the class is not enough, adding the above does work:
user=> (enumeration-seq (. java.sql.DriverManager getDrivers))
([EMAIL PROTECTED] [EMAIL PROTECTED
On Thu, Oct 9, 2008 at 3:09 PM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> The question is, are people willing to deal with the breakage in the
> short term?
I certainly am, but that may not mean much. :-)
Nobody has spoken out against it yet -- that's a got to be a good sign.
> Could there be a
> The following fails:
>
> user=> (cast java.sql.Driver (clojure.lang.RT/classForName
> "com.mysql.jdbc.Driver"))
> java.lang.ClassCastException (NO_SOURCE_FILE:0)
>
> The com.mysql.jdbc.Drive does implement the java.sql.Driver interface:
>
> user=> (bases (clojure.lang.RT/classForName "com.mysq
On Thursday 09 October 2008 12:09, Rich Hickey wrote:
> ...
>
> The question is, are people willing to deal with the breakage in the
> short term?
I have no skin in this game, so what I say is to be taken with a grain
of salt, but...
If you make this change, millions of Clojure users for all et
On Oct 9, 4:48 pm, Chouser <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 9, 2008 at 3:09 PM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> > The question is, are people willing to deal with the breakage in the
> > short term?
>
> I certainly am, but that may not mean much. :-)
> Nobody has spoken out ag
Oups... I knew I was making some stupid mistake here...
I need to do this instead:
user=> (enumeration-seq (. java.sql.DriverManager getDrivers))
([EMAIL PROTECTED])
user=> (java.sql.DriverManager/registerDriver (new
com.mysql.jdbc.Driver))
nil
user=> (enumeration-seq (. java.sql.DriverManager
ge
Allow cond-like specification of expression pairs and allow odd number
of expressions. Let odd expressions in last position serve as default
return value. There will be no impact on previous reading/writing of
"if". Stolen from Paul Graham's Arc.
(defmacro myif
([x] x)
([x y] (if
Looks that this 'if works the same:
http://www.newlisp.org/downloads/newlisp_manual.html#if
Frantisek
PS: There are some very nice functions in newLISP. We could borrow from it
too :-)
On Thu, 09 Oct 2008 23:29:55 +0200, Dmitri P <[EMAIL PROTECTED]>
wrote:
>
> Allow cond-like specification
Thanks for making me take another look at my needs.
It turns out all I needed was to create a lazy sequence, and then take
values out of it. I don't know why I was trying to make it more
complicated than necessary.
--~--~-~--~~~---~--~~
You received this message bec
On Oct 9, 2008, at 5:29 PM, Dmitri P wrote:
> Allow cond-like specification of expression pairs and allow odd number
> of expressions. Let odd expressions in last position serve as default
> return value. There will be no impact on previous reading/writing of
> "if". Stolen from Paul Graham's Arc
On Oct 9, 8:46 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> You can to force evaluation of *indent* while preserving the lazyness
> of the code that uses *indent*:
>
> (with-indent
> (print *indent*)
> (let [ind *indent*]
> (lazy-cons ind (cons ind nil
>
> If this idiom is use
On Oct 9, 7:28 pm, Sacha <[EMAIL PROTECTED]> wrote:
> On Oct 9, 8:46 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote:
>
> > You can to force evaluation of *indent* while preserving the lazyness
> > of the code that uses *indent*:
>
> > (with-indent
> >(print *indent*)
> >(let [ind *indent*
On Oct 9, 2:46 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> Sacha,
>
> You can to force evaluation of *indent* while preserving the lazyness
> of the code that uses *indent*:
>
> (with-indent
>(print *indent*)
>(let [ind *indent*]
> (lazy-cons ind (cons ind nil
>
> If this i
http://clojure.org/special_forms
shows:
(def mult
(fn this
([] 1)
([x] x)
([x y] (. clojure.lang.Num (multiply x y)))
([x y & more]
(apply this (this x y) more
and should probably be referencing clojure.lang.Numbers.
Thanks,
Kyle
--~--~-~--~-
On Thu, Oct 9, 2008 at 4:57 PM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> Go for it.
(defmethod print-method java.util.regex.Pattern [p #^Writer w]
(.write w "#\"")
(loop [[#^Character c & r :as s] (seq (.pattern #^java.util.regex.Pattern p))]
(when s
(cond
(= c \\) (do (.a
On Tue, Oct 7, 2008 at 2:57 PM, Stuart Halloway
<[EMAIL PROTECTED]>wrote:
>
> This is a tangent from Brian's question about struct inheritance:
> While I am not sure that I want struct inheritance, it seems
> unnecessarily hard to write the macro for it. Structs are not first
> class citizens, in
> I'm confused - what was your expectation here? In what way is Clojure
> different from CL?
>
> Rich
Nothing is different. Sorry i wasn't very explicit. That's the way a
special should work, and expecting a different behaviour for lazyness
did not make sense.
Sacha
--~--~-~--~~
Slime fails to start with the latest clojure, svn 1057. swank-clojure
doesn't use the new ## feature, but there was a change to #' and that
seems to be the line that fails.
user=> java.lang.UnsupportedOperationException: Vars are not values
(basic.clj:12)
user=> java.lang.Exception: No such var:
52 matches
Mail list logo