Hi,
was there a change to the wikibook policy I missed?
Suddenly I cannot edit the wiki anymore, because
every change has to approved by an "authorized"
user, whoever that may be.
Is this intended (eg. because of spam) or is that a
change of wikibooks itself, impacting in particular the
Clojure
Hi,
there were some breaking changes in the SVN head lately
in preparation of v1.0. Rich updated the ants demo some
days, ago. So maybe you now have the new demo with the
"old" clojure. I got the demo working without problems before
the changes.
Sincerely
Meikel
--~--~-~--~~
well, it has changed quite a lot now: (i'm not sure if this all
actually works yet. they key map does, though)
;;gui imports. hurray!
(import
'(javax.swing JFrame)
'(java.awt Canvas)
'(java.awt.event KeyListener KeyEvent
MouseListener MouseEcent
FocusListen
Would you mind posting your working version?
I tried your code with the keyPressed changed, but I get an exception
whenever I press a key
Exception in thread "AWT-EventQueue-0" java.io.IOException: Stream
closed
so something else must have changed also?
On Nov 20, 3:21 pm, notallama <[EMAIL PROTE
Since SVN rev 1110:
user=> (compile 'clojure.contrib.str-utils)
java.lang.Exception: Namespace name must match file, had:
clojure.contrib.str-utils and clojure/contrib/str_utils.clj
(NO_SOURCE_FILE:0)
I think the only problem is that the test to generate this exception
asserts that classnames equ
figured it out.
my prints were going to the inferior lisp buffer.
i feel kinda silly now.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googlegroups.co
On Wed, Nov 19, 2008 at 6:15 PM, samppi <[EMAIL PROTECTED]> wrote:
>
> I'm just wondering—is there a way to match methods' dispatch-values
> using a function other than isa?—such as with a macro.
This came up on IRC last week:
http://clojure-log.n01se.net/date/2008-11-14.html#17:40a-17:52
--Cho
so i made a typo.
KeyPressed should be keyPressed
still nothing, though. tried making the listener seperate, adding it
to the frame, making the frame implement KeyListener and adding
itself. nothing.
--~--~-~--~~~---~--~~
You received this message because you are s
so, for a key listener, the keypressed method is called when you press
a key, right?
or am i misunderstanding how events work?
this is what i have:
(import
'(javax.swing JFrame)
'(java.awt Canvas)
'(java.awt.event KeyListener KeyEvent))
(def app (JFrame.))
(def canvas
(proxy [Canvas Ke
On Nov 19, 6:51 pm, mifrai <[EMAIL PROTECTED]> wrote:
> I know it's minor and nit-picky but so long as we're rolling out so
> many breaking changes is it possible to reclaim scan and touch instead
> of leaving dead functions that need an :exclude?
Yes, done.
Rich
--~--~-~--~~--
Not sure if this will help with what you are working on. I ran across
a similar problem last week and ended up writing a generic library
that converts various sizes of integers to big or little endian byte
arrays and then back again.
Code is located at:
http://github.com/jbester/cljext/tree/mas
I know it's minor and nit-picky but so long as we're rolling out so
many breaking changes is it possible to reclaim scan and touch instead
of leaving dead functions that need an :exclude?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
On Nov 19, 8:23 pm, Chouser <[EMAIL PROTECTED]> wrote:
> _Jordan_ in IRC discovered a bug that can be distilled to:
>
> user=> (let [x [3 2 1]] (sort x) x)
> [1 2 3]
>
> The sort function mutates the vector. This can happen because the
> toArray() method of LazilyPersistenVector returns its own
_Jordan_ in IRC discovered a bug that can be distilled to:
user=> (let [x [3 2 1]] (sort x) x)
[1 2 3]
The sort function mutates the vector. This can happen because the
toArray() method of LazilyPersistenVector returns its own internal
array, instead of creating a new array like most other colle
I'm just wondering—is there a way to match methods' dispatch-values
using a function other than isa?—such as with a macro. This is what
I'm thinking of:
(defmulti foo identity #(re-find %2 %1)) ; uses the last function
instead of isa? to match
(defmethod foo #"xyzzy" [x]
x))
(defmetho
Thanks Stu! I wasn't aware of the meta function. That helps a lot!
I looked for occurrences of "(meta " throughout the clojure and
clojure-contrib repositories, but I didn't find a function that prints
the code for a given function. That would be incredibly useful for
learning! Does anybody know
On Wed, Nov 19, 2008 at 4:49 PM, Mark Volkmann
<[EMAIL PROTECTED]> wrote:
>
> On Wed, Nov 19, 2008 at 2:45 PM, prhlava <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hello again,
>>
>> Thank you all for the posts and explanations,
>>
>> After getting the clojure SVN version and few tweaks in the code, the
>>
On Wed, Nov 19, 2008 at 4:00 AM, Michael Wood <[EMAIL PROTECTED]> wrote:
>
> Exception in thread "main" java.lang.IllegalArgumentException: No
> matching method found: getString for class
> org.dcm4che2.data.BasicDicomObject (dinfo.clj:0)
This was discussed on IRC:
http://clojure-log.n01se.net/d
Hi all,
I'm new to clojure and I've just been trying to get the ants demo from
the video lectures to work. I presume I've done something wrong
because I get a screen full of errors when I load in the ants.clj file
(pasted below). I tried copying and pasting the code in bit by bit
(if I paste too
Hi,
first of all hello to everybody as I'm new to this group.
I'm starting to learn Clojure, and therefore I studied the ants.clj
program. It's more or less clear to me how it works, but I stumbled
across a small detail that made me wonder.
In the "behave" function for the ant agent, there's th
Hi Mark,
The metadata points to the source:
user> (meta #'with-open)
{:doc "bindings => name init\n\n Evaluates body in a try expression
with name bound to the value of\n init, and a finally clause that
calls (.close name).", :ns #, :arglists
([bindings & body]), :file "core.clj", :name
On Wed, Nov 19, 2008 at 2:45 PM, prhlava <[EMAIL PROTECTED]> wrote:
>
>
> Hello again,
>
> Thank you all for the posts and explanations,
>
> After getting the clojure SVN version and few tweaks in the code, the
> working result looks like:
>
> (with-open [ofile (new java.io.Fil
On Wed, Nov 19, 2008 at 4:16 PM, Mark Volkmann
<[EMAIL PROTECTED]> wrote:
>
> I'm reading an excellent article on functional programming at
> http://www.defmacro.org/ramblings/fp.html. Toward the end there is a
> section on pattern matching. They give the following example which
> uses a fictional
(defmulti fib (fn [x] x) :default)
(defmethod fib 0 [x] 0)
(defmethod fib 1 [x] 1)
(defmethod fib :default [n] (+ (fib (- n 2)) (fib (- n 1
seems to do the trick.
On Wed, Nov 19, 2008 at 1:25 PM, Kyle R. Burton <[EMAIL PROTECTED]> wrote:
>
> I have no idea how much effort it would be, but I'
I have no idea how much effort it would be, but I've found the common
lisp pcond library to be useful for pattern matching and a few other
use cases:
http://www.cliki.net/pcond
I'd also like to see support for value based as well as structural
shape based pattern matching.
Regards,
Kyle
On
I'm reading an excellent article on functional programming at
http://www.defmacro.org/ramblings/fp.html. Toward the end there is a
section on pattern matching. They give the following example which
uses a fictional, Java-like syntax. Can Clojure do something like this
where the fib function is ove
On Nov 19, 2:35 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> Rich,
>
> Very helpful, as always. Alias + the ability to pull in symbols names
> via refer was exactly what I was looking for.
>
> One scenario still worries me:
>
> 1. I create a multimethod that dispatches around a tag whose val
Scottsdale, Arizona (USA)
On Oct 17, 2:27 am, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote:
> Hello Clojurians,
>
> I think after 1st year of Clojure life it's good to check how far has
> Clojure spread all over the world.
>
> So wherever areyoucomefrom, be proud and say it.
>
> I'm from Slovakia
I also made updates to support the doto change, if git is easier for
you then pull from git://github.com/mattrepl/swank-clojure.git
-Matt
On Nov 19, 2008, at 1:30 PM, Stephen C. Gilardi wrote:
> On Nov 19, 2008, at 1:15 PM, Mike Hinchey wrote:
>> Clojure svn 1110 does work with latest swank-c
Hello again,
Thank you all for the posts and explanations,
After getting the clojure SVN version and few tweaks in the code, the
working result looks like:
(with-open [ofile (new java.io.FileOutputStream
(str result-directory
Rich,
Very helpful, as always. Alias + the ability to pull in symbols names
via refer was exactly what I was looking for.
One scenario still worries me:
1. I create a multimethod that dispatches around a tag whose value is
an unresolved keyword (:Foo instead of ::Foo). Everything works fine
Hi,
> Dealing with byte-arrays, you will want to use the write-method that
> takes an array, not the one that takes a string.
>
> Constructing the array is a bit tricky:
>
> ; Define your int
> (def pix 652187261)
>
> ; Define your array, typed as array of char
> (def payload
> (into-array Chara
Hello,
While using clojure.contrib.sql I find many times that I am not
generating good SQL (like when doing create-table with bad arguments).
I'd like to add a debugging mode for clojure.contrib.sql, that when
enable, it would cause it to print the statements or something like
that. Is there any
On Nov 19, 2:21 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> Fixed (svn 1112) - thanks for the report.
>
> The problem is that the Java reflection APIs return new Boolean values
> other than the canonic Boolean.TRUE and Boolean.FALSE when boxing
> booleans, but for efficiency only canonic fals
In general, Writers are for character data and OutputStreams are for
binary data. If possible, create a FileOutputStream like this:
(ns my.ns
(:import (java.io FileOutputStream)))
(def ofile (FileOutputStream. "/some/file/somewhere"))
and use one of the write methods of FileOutputStream.
--~-
On Nov 19, 1:12 pm, Raffael Cavallaro <[EMAIL PROTECTED]>
wrote:
> user> (def test-array (make-array (. Boolean TYPE) 100))
> #'user/test-array
> user> (aget test-array 0)
> false
> user> (= (aget test-array 0) false)
> true
> user> (if (aget test-array 0) 'true-value 'false-value)
> true-value
> The reason why is the first part of your domain is
> unimportant and possibly likely to change.
Much in the same way we have:
java.lang.Math
... and ...
com.sun.awt.AWTUtilites, or, even "better":
com.sun.org.apache.*
:-) :-) :-) :-)
--~--~-~--~~~---~--~~
Yo
I am not familiar with how Java's arithmetic works, but it seems from
http://hanuska.blogspot.com/2007/08/arithmeticexception-vs-nan.html
and http://www.concentric.net/~Ttwang/tech/javafloat.htm that dividing
a double or float by 0 should result in positive or negative infinity
(like Double.POSITI
Chicago, IL - USA
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For mor
On Nov 19, 5:51 pm, prhlava <[EMAIL PROTECTED]> wrote:
> (. ofile write (str
> (char (bit-shift-right pix 16))
> (char (bit-shift-right pix 8))
> (char pix)))
>
On Nov 19, 2008, at 1:15 PM, Mike Hinchey wrote:Clojure svn 1110 does work with latest swank-clojure.But, svn (doto) breaks swank again.I've enclosed a patch. Patch with:cd swank-clojurepatch -p1 < swank-clojure-doto.patch--Steve
swank-clojure-doto.patch
Description: Binary data
Clojure svn 1110 does work with latest swank-clojure.
But, svn (doto) breaks swank again.
user=> java.lang.Exception: Unable to resolve symbol: start in this context
(thread.clj:10)
user=> java.lang.Exception: No such var: swank/ignore-protocol-version
(NO_SOURCE_FILE:5)
user=> java.lang.Exc
user> (def test-array (make-array (. Boolean TYPE) 100))
#'user/test-array
user> (aget test-array 0)
false
user> (= (aget test-array 0) false)
true
user> (if (aget test-array 0) 'true-value 'false-value)
true-value
Same issue with when, and when-not as well. IOW, (aget some-boolean-
array some-in
Paul wrote:
> This looks very interesting but when I try to execute clojure code (either
> from the editor or the REPL) I get the following error:
>
> "Could not initialize class clojure.lang.RT"
I will contact you off list to work on resolving the problem.
Thanks,
Ted
--~--~-~--~
I like this solution as well. You have to pull in the seq-utils for the
indexed
function though.
(use 'clojure.contrib.seq-utils)
(defn nonzero-idxs [s]
(for [[i n] (indexed s) :when (and n (not (zero? n)))] i))
On Wed, Nov 19, 2008 at 10:39 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
>
>
I would prefer to see this not become a convention in Clojure. The
reason why is the first part of your domain is unimportant and
possibly likely to change. The hibernate project was a good example
of this. They were first hosting it on sourceforge, so they made all
their packages net.sf.hibern
On Nov 19, 11:18 am, capricorn20 <[EMAIL PROTECTED]> wrote:
> I want create seq which keep indexes of non-zero elements of
> collection.
> Code:
>
> (defn nonzero-inx [s]
> (filter (fn [x] (not (nil? x))) (map (fn [a b] (if (not (== a 0))
> b)) s (range (count s)
>
> look complicated than
> I'm from Slovakia. :)
I am from my mum who was in Slovakia at the time of my birth ;-) (and
I have grown up in Slovakia)
Vlad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this grou
Hello all,
I have started to play with the clojure a day ago and today I have
almost finished porting simple program (from plt-scheme).
The place I got stuck in is - how to write a binary value (multiple
bytes) in one write operation to a file... The code uses
java.io.FileWriter, but this wants
I want create seq which keep indexes of non-zero elements of
collection.
Code:
(defn nonzero-inx [s]
(filter (fn [x] (not (nil? x))) (map (fn [a b] (if (not (== a 0))
b)) s (range (count s)
look complicated than solution in most imperative languages.
May be possible simplest way in Clojure
Hi all,
I'm happy to release clj-html, an HTML compilation library.
clj-html tries to combine the functional interface and expressive
literal vector syntax of compojure's HTML library[1] with the
compilation model of cl-who[2]. The goal is to start with easy-to-read
and concise templates, proces
On Nov 19, 10:07 am, Stuart Sierra <[EMAIL PROTECTED]>
wrote:
> Hmm, it seems strange to me that this works at all:
>
> user=> (eval '(list + 1 2 3))
> (# 1 2 3)
> user=> (eval *1)
> 6
>
> Does that mean that functions evaluate to themselves?
>
Sure, they always have (think map). The trick is,
On Oct 23, 9:53 am, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto->
>
> > The name is actually also up to discussion. doto is already
> > in use and this change is incom
Here's my second attempt. I fixed one obvious bug but it was the
addition of the type "#^ByteBuffer" that made a *huge* difference.
The times now look something like:
Compile file /home/aim/src/clojure/foo.clj ...
"Elapsed time: 64.273962 msecs"
"Elapsed time: 59.607317 msecs"
"Elapsed tim
Hmm, it seems strange to me that this works at all:
user=> (eval '(list + 1 2 3))
(# 1 2 3)
user=> (eval *1)
6
Does that mean that functions evaluate to themselves?
-Stuart Sierra
On Nov 19, 9:01 am, "J. McConnell" <[EMAIL PROTECTED]> wrote:
> In writing up tests for clojure.contrib.test-cloj
On Wed, Nov 19, 2008 at 10:01 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Nov 19, 9:01 am, "J. McConnell" <[EMAIL PROTECTED]> wrote:
>>
>> (eval (eval '(list + 1 2 3)))
>>
>> should I be testing to
>> ensure that the above form produces 6? My suspicion is yes, but I
>> wanted to check anyhow.
Hi,
I was experimenting with using mmap from clojure but I see vastly
different timings when compared to plain old Java and
MappedByteBuffer.
Here's my code and also represents the largest bit of clojure I have
written:
(import '(java.io File))
(use 'clojure.contrib.mmap)
(def my-file (
On Nov 19, 9:01 am, "J. McConnell" <[EMAIL PROTECTED]> wrote:
> In writing up tests for clojure.contrib.test-clojure that cover the
> Evaluation page of clojure.org, I came across the fact that the
> following threw a CompilerException due to a
> "java.lang.ClassNotFoundException: clojure._PLUS_
Thanks to everyone who answered. The custom macro seems to be the way
to go for a local method. I'm no good at macros, though, so I suppose
I have to confront them and figure them out now. :)
On Nov 19, 5:20 am, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> You could write a with-method macro that
On Nov 19, 7:45 am, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am working on the multimethod chapter this week. This has required a
> lot of exploration, as the multimethod feature set goes well beyond
> what most people are using yet. I have hit one rough spot: derive. I
> have
Hello stuart,
On 19 Nov., 13:45, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> I am working on the multimethod chapter this week. This has required a
> lot of exploration, as the multimethod feature set goes well beyond
> what most people are using yet. I have hit one rough spot: derive. I
>
In writing up tests for clojure.contrib.test-clojure that cover the
Evaluation page of clojure.org, I came across the fact that the
following threw a CompilerException due to a
"java.lang.ClassNotFoundException: clojure._PLUS___224":
(eval (eval '(list + 1 2 3)))
After the AOT changes, this no l
I am writing a small Clojure tutorial which tries to explore different
facets of the language, while still producing a semi-useful program.
I posted the second part on my blog yesterday. Many thanks to Chouser
for proof-reading the document!
http://gnuvince.wordpress.com/2008/11/18/fetching-web-
Hi all,
I am working on the multimethod chapter this week. This has required a
lot of exploration, as the multimethod feature set goes well beyond
what most people are using yet. I have hit one rough spot: derive. I
have working code (below), but I don't like the way I have to call it
wit
In Clojure, specific implementations of a Clojure multimethod are
called methods.
Cheers,
Stuart
> What do you mean by methods as distinct from functions? In clojure
> there are only functions. Are you referring to Java methods?
--~--~-~--~~~---~--~~
You recei
You could write a with-method macro that adds a method to a
multifunction, and then removes it at the end of the test. It would be
dynamically scoped, but that should be good enough for test setup/
teardown.
Stuart
>
> I'm trying to unit-test a library with which a user can define methods
>
This looks very interesting but when I try to execute clojure code (either
from the editor or the REPL) I get the following error:
"Could not initialize class clojure.lang.RT"
2008/11/18 Ted Kosan <[EMAIL PROTECTED]>
>
> I am in the process of developing a mathematics-oriented IDE called
> Math
Singapore +1.
On Wed, Nov 19, 2008 at 5:24 PM, walterc <[EMAIL PROTECTED]> wrote:
>
> taipei, taiwan
>
> cheers,
>
> walter chang
> >
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to thi
Seattle, WA
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more opti
I'm not native english speaker, so Clojury and Jewel doesn't sound
cute to me. :)
In Slovak we have very rich gramatical system for creating cute words,
even in more levels, so any word in its base form doesn't sound cute
to us.
So, I'm really sorry, I didn't mean it cute way.
On 11/18/08, Paul
On Nov 19, 12:08 am, Matt Revelle <[EMAIL PROTECTED]> wrote:
> On Nov 18, 2008, at 9:42 AM, Raffael Cavallaro <[EMAIL PROTECTED]
> wrote:
> > As the old chestnut goes, one never gets a second chance to make a
> > first impression. The first impression one gets now does *not* reflect
> > the qual
taipei, taiwan
cheers,
walter chang
--~--~-~--~~~---~--~~
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 [EMAIL
On Oct 17, 11:27 am, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote:
> Hello Clojurians,
>
> So wherever are you come from, be proud and say it.
Sofia, Bulgaria
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure"
In September I was trying out the Java interop support of Clojure by
converting this:
http://www.dcm4che.org/confluence/display/d2/Accessing+dcm4che2+Toolkit+with+Jruby
to Clojure.
I was using the 20080612 release and got an exception like this:
Exception in thread "main" java.lang.IllegalArgu
Hi,
On 19 Nov., 09:47, Simon Brooke <[EMAIL PROTECTED]> wrote:
> Java has a simple and neat convention for achieving global namespace
> distinctness without the overhead of a central registry - you just
> reverse your domain name and append a bit. Is there a similar
> convention for Clojure names
Java has a simple and neat convention for achieving global namespace
distinctness without the overhead of a central registry - you just
reverse your domain name and append a bit. Is there a similar
convention for Clojure namespaces?
--~--~-~--~~~---~--~~
You receive
Hi,
the following thread was a poll for features, but also about what
people do
with Clojure.
http://groups.google.com/group/clojure/browse_thread/thread/7bf9257fea4a0c47/93c8e34baa18ca59?lnk=gst&q=POLL#93c8e34baa18ca59
Sincerely
Meikel
--~--~-~--~~~---~--~~
You
Three things:
* rewriting an agent-based hiv-evolution model that I am using in my
phd from ruby to clojure.
* learning a new (sensible - multicore compatible) programming
language to use as a postdoc
* (right now neglected, as I'm finishing my phd: building an agent-
based model to study the eff
78 matches
Mail list logo