I haven't done much beyond verify that the error is gone, but it
appears that your patch solved my immediate issue. Thanks for the
quick fix, Christophe!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" gro
Jump on in! Just like with swimming the cold soon goes away. I found
that without types it was mentally taxing to understand many function
description. Something that helped me was collecting examples for
functions as I came across them:
http://en.wikibooks.org/wiki/Clojure_Programming/Examples/A
Hi Curtis,
I get my fuzzies from at least a few places:
1. bottom-up, interactive development. This means frequent testing
(at the REPL) of individual or small sets of functions, as I write
them.
2. assertions liberally sprinkled in key places.
3. multimethods that are difficult to call
Hey everyone. I've been keeping up with developments in Clojure for a
few months now and have a question for all you long-time static typers
out there (I know you're there :)
I really like what I read about Clojure and LISP in general and can
see the potential for great power and flexibility. I k
I wrote a Clojure script that wraps the Apache commons-client library for
crawling the web. It's a simple 125 line script and I also wrote some test
cases for it as well. I was wondering if this is something that
could/should
be included in clojure.contrib or if it should be a standalone Clojure
HI Bill,
I also tried the metadata tag and couldn't get it to work, but the
following does...
(ns gncls.MyStatic
(:gen-class
:methods [[say-hi [String] String]]))
(defn -say-hi
[this who]
(str "Hi " who))
(defn -say-static-hi
[who]
(str "Hi " who))
user=> (compile 'gncls.MySta
The genclass documentation says, "Static methods can be specified with
#^{:static true} in the signature's metadata." I thought that would
mean this:
(ns tango.test.unit.StaticTest
(:gen-class
:methods [[f [] #^{:static true} void ]]))
(defn -init [_] ())
(defn -f [] (println "hello w
Would someone mind showing me a brief example of how to define a
static method (using gen-class)?
Thanks,
Bill Smith
Austin, TX
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group
There's some in the wikibook
http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Cookbook
Also
http://en.wikibooks.org/wiki/Clojure_Programming/Examples
I've been trying to tidy it up a little, and would love the help. Add
you own stuff!
Sean
On Mar 9, 10:00 pm, David Sletten wrote:
Has anyone done any work towards assembling a cookbook of Clojure
recipes along the lines of the Perl/Ruby Cookbooks? Even something
less formal such as the Common Lisp Cookbook would be useful (http://
cl-cookbook.sourceforge.net/index.html).
It would be good to have something like this in
> (let [person (get-the-person)]
> (when-not (nil? person)
> (let [address (.getAddress person)]
> (when-not (nil? address)
> (let [street (.getStreet address)]
> (when-not (nil? street)
> (do-something-finally-with-street street)
>
?-> sounds
When you add a watch to a ref (as opposed to an agent), when is it called?
After transaction commit, I assume, but can someone confirm that. The docs
for add-agent mention that the watch function might be called from various
threads. If used from a dosync, can it be called from a different thread
The subject mostly says it all. Example:
;;;
user=> (ancestors String)
#{java.io.Serializable java.lang.Object java.lang.CharSequence
java.lang.Comparable}
user=> (ancestors Object)
nil
user=> (derive String ::foo)
nil
user=> (derive Object ::bar)
nil
user=> (isa? String ::foo)
true
us
> Membership to this group is _very_ self-selecting; you can't expect
> things that are true here to be true across the board.
>
> -Phil
I expect membership will increase once Stu's book is released. It will
give people a much more structured way to get familiar with the
language.
--~--~
I support your proposal :)
On Mar 10, 9:10 am, Laurent PETIT wrote:
> Hello,
>
> I have the use case for calling instance? where, once instance? returns
> true, I want to do something with the successful instance, such as binding
> it, or directly calling something on it.
>
> For instance, I ha
Hello,
When interacting with java code, and maybe in other pure clojure situations
as well (but I have not encountered the case myself), I was faced with
writing boiler plate code to check whether the return values of a chain of
calls to successive instance members were null before continuing ...
Well, there is no real replacement for raw intelligence, but I hope we'll
all agree that attitude and curiosity are also critical.
On Mon, Mar 9, 2009 at 7:33 PM, Phil Hagelberg wrote:
>
> bOR_ writes:
>
> > I'm not from the software engineers field, but how difficult is it for
> > some non-lis
bOR_ writes:
> I'm not from the software engineers field, but how difficult is it for
> some non-lisp, but java-savvy software writer to pick up a 600-line
> clojure program and learn to understand it?
I suspect it has more to do with people thinking they can't do it than
any actual lack of abi
I'm not from the software engineers field, but how difficult is it for
some non-lisp, but java-savvy software writer to pick up a 600-line
clojure program and learn to understand it? I mean, everyone in this
forum managed to learn clojure to some degree without too much
trouble.. including me. If
cl-format has this built-in:
(cl-format nil "~:(~a~)" "the quick brown fox") -> "The Quick Brown
Fox"
Tom
On Mar 8, 10:48 am, christophe turle wrote:
> my try :
>
> ;;; *** application code ***
>
> ;;; (my-capitalize "ab c") -> "Ab C"
> ;;; (my-capitalize "ab") -> "Ab"
> ;;; (my-capitalize "")
After reading a bit of stuff here and there about Swing and Qt Jambi,
I've recently started tinkering with the latter. Unfortunately, I
pretty quickly grew frustrated with the need to call out to
QCoreApplication/invokeAndWait every single time I wanted to change a
part of the GUI from the REPL o
I've lived through this discussion for the past 3 years while writing web
applications using Ruby and Rails. Here's what I've learned:
- Using a language that the average stupid programmer can't understand
virtually guarantees that you'll increase your success chances, since you
and your team-mate
Hello,
I have the use case for calling instance? where, once instance? returns
true, I want to do something with the successful instance, such as binding
it, or directly calling something on it.
For instance, I have in my code :
(let [console (.getConsole v)]
(when (instance? org.eclipse.debug
On Mar 9, 3:16 pm, MikeM wrote:
> From the original post: "A command line option for loading user.clj
> could be added for
> repl usage."
The whole discussion is about what the default should be since
obviously one could make either behavior optional via command line
switches. Since a majori
On Mon, Mar 9, 2009 at 2:16 PM, MikeM wrote:
>
>
>
> On Mar 9, 2:18 pm, Raffael Cavallaro
> wrote:
> > On Mar 9, 10:58 am, MikeM wrote:
> >
> > > Could you share what benefits you get by the auto-load of user.clj
> > > early in the launch process?
> >
> > It allows the automatic loading of devel
Just for the record, this problem with read-line was fixed at SVN
r1321.
(Thanks for packaging up the patch, Chouser.)
Perry
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, se
Hi,
This was fixed at SVN revision 1321 on Mar 3:
http://code.google.com/p/clojure/source/detail?r=1321
David, the lazy branch was merged into trunk (at r1287) -- track trunk
& you'll have what you need (lazy-seq, not lazy-cons).
Best,
Perry
--~--~-~--~~~---~--~-
On Mar 9, 2009, at 8:41 AM, Jason Wolfe wrote:
>
> I think this was discussed here:
>
> http://groups.google.com/group/clojure/browse_frm/thread/
> 48f1fb08b3052083/85f858df39daca2a?
> hl=en&lnk=gst&q=linenumberingpushbackreader#85f858df39daca2a
>
> I'm not sure what the resolution was, if any
On Mon, Mar 9, 2009 at 9:55 AM, Tuomas J. Lukka wrote:
>
> You are "holding on to the head". Try replacing "def perms" with "defn
> perms []" and calling it when you start using it. That way the
> permutations are let go as soon as they come. I noticed this with some
> scripts that go through lar
Java doesn't have a C-like structure type, so Java objects still have
overhead. If you want the absolute minimum number of bytes in memory,
you can create Java primitive arrays in Clojure:
(make-array Integer/TYPE 100)
Then access them with the "aset..." and "aget" functions.
-Stuart Sierra
ok oops that didn't work, sorry -- i mean to send this link:
http://www.ccs.neu.edu/home/samth/typed-scheme/manual/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email
On Sun, Mar 8, 2009 at 12:45 PM, André Thieme
wrote:
>
> I like that Clojure is a dynamically typed language.
> Even in dynamic languages it is possible to find out a lot more
> about the code itself than one may think on a first glance.
> Clojure already supports type hints that can make code ru
Hi Tim,
your getArg function is actually a nice use case
of a not very often used of condp: :>>.
Please note in the following example: as David
Nolen said, we have to use seq after re-seq since
re-seq doesn't return a nil but the empty list.
Hence I used comp to chain the two together.
Also inco
On Mar 5, 6:29 pm, BerlinBrown wrote:
> http://code.google.com/p/lighttexteditor/
>
> * Simpletexteditor.
> * Simple File Manager for accessing important files quickly.
> * Search tools using Linux or Win32 applications (unxutils).
> * Built on Java 1.5 and the Clojure programming language.
>
>
On Mar 9, 2:18 pm, Raffael Cavallaro
wrote:
> On Mar 9, 10:58 am, MikeM wrote:
>
> > Could you share what benefits you get by the auto-load of user.clj
> > early in the launch process?
>
> It allows the automatic loading of development utilities with each
> repl launch.
>
> It gets tiresome ha
On Mar 9, 10:55 am, Dirk Vleugels wrote:
> (defn extract [ s i ]
> (conj [] (nth s i) (nth s (inc i)) (nth s (inc (inc i)
(defn extract [s i] (subvec (vec s) i (+ i 3)))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
I think this was discussed here:
http://groups.google.com/group/clojure/browse_frm/thread/48f1fb08b3052083/85f858df39daca2a?hl=en&lnk=gst&q=linenumberingpushbackreader#85f858df39daca2a
I'm not sure what the resolution was, if any.
-Jason
On Mar 9, 4:33 am, David Sletten wrote:
> While using
A friend, Mike Easter, told me about a podcast on transactional memory
that he really found valuable. After listening to it, I agree and felt
I should pass it on.
http://www.se-radio.net/podcast/2007-09/episode-68-dan-grossman-garbage-collection-and-transactional-memory
After listening to this i
On Mar 9, 10:58 am, MikeM wrote:
> Could you share what benefits you get by the auto-load of user.clj
> early in the launch process?
It allows the automatic loading of development utilities with each
repl launch.
It gets tiresome having to always do:
(load "my-uils")
(or, equivalently, (lo
Thanks, Christophe. Hopefully I'll have a chance to check it out this
evening.
On Mar 9, 10:29 am, Christophe Grand wrote:
> http://code.google.com/p/clojure/issues/detail?id=93
>
> Paul, you can experiment with the patch if you wish.
>
> Christophe
>
> Christophe Grand a écrit :
>
>
>
>
>
> > O
http://code.google.com/p/clojure/issues/detail?id=93
Paul, you can experiment with the patch if you wish.
Christophe
Christophe Grand a écrit :
> Ok, working on it.
>
> Rich Hickey a écrit :
>
>> On Mar 9, 5:04 am, Timothy Pratley wrote:
>>
>>
>>> Hi Paul,
>>>
>>>
>>>
>>
On Mar 9, 2009, at 5:48 AM, timc wrote:
>
> (re-seq #"([a-zA-Z_0-9]+)=([^ ]+)" arg))]
>
Two small suggestions--it's easier, and more legible to use \S to
match non-whitespace characters:
(re-seq #"([a-zA-Z_0-9]+)=(\S+)" arg)
And you've basically defined the "word character" cl
On Mar 9, 10:48 am, timc wrote:
> Can someone please see what's wrong with this.
>
> (defn getArg [arg]
> "Return a [keyword value] depending on the form of the string arg:
> 1. arg is of the form +x ==> [:x true].
> 2. arg is of the form -x ==> [:x false].
> 3.
The lack of a debugger seriously hindered my development process in
the beginning. You should look into the IntelliJ plugin. It's very
well done, and debugging works flawlessly out of the box. It's sped up
my productivity by a factor of three at the very least.
I have given Emacs+Slime a fair cha
Timothy, thanks for explaining - I respond to one specific part below:
> Interop with Java is a real strength of Clojure. But doing so is less
> useful for learning Clojure and more useful for learning Java. Feel
> free to pursue it, Java interop is certainly not wasted effort/
> knowledge. It ce
Thanks Stuart, Bill - both answers are very useful.
On Mon, Mar 9, 2009 at 6:58 PM, .Bill Smith wrote:
>
>> Here is one way:
>>
>> (-> (into-array ["one" "two"]) (class) (.getComponentType))
>> -> java.lang.String
>> (-> (to-array ["one" "two"]) (class) (.getComponentType))
>> -> java.lang.Obj
I'm writing a program that will have millions of small structures in
it. If I were writing in C (or Java I guess), I estimate the object
size to be about 40 bytes. In Clojure, using a struct map I've made a
rough measure & I think that the objects are weighing in at about
200bytes.
1) I know th
> Here is one way:
>
> (-> (into-array ["one" "two"]) (class) (.getComponentType))
> -> java.lang.String
> (-> (to-array ["one" "two"]) (class) (.getComponentType))
> -> java.lang.Object
The above answer seems to answer the question, "How do I determine
what type of object is inside an array?"
You are "holding on to the head". Try replacing "def perms" with "defn
perms []" and calling it when you start using it. That way the
permutations are let go as soon as they come. I noticed this with some
scripts that go through large files: it's really important to create
lazy longs sequences jus
Hi Adrian,
Here is one way:
(-> (into-array ["one" "two"]) (class) (.getComponentType))
-> java.lang.String
(-> (to-array ["one" "two"]) (class) (.getComponentType))
-> java.lang.Object
Stu
>
> I have a java object that either contains a String or an array of
> Strings.
>
> (instance? java
I should re-test before post. This version of the main loop actually
terminates (for smaller numbers), but will still blow up:
(loop [ p (first perms) r (rest perms) s 0 c 0 ]
(if (> c 8)
s
(if (every? #(%1 p) guards)
(do
(println p)
(recur (first r) (rest r) (+ s
Thanks David.
On Mar 9, 4:22 pm, David Nolen wrote:
> The first regex is returning an empty list not nil.
> David
>
> On Mon, Mar 9, 2009 at 11:48 AM, timc wrote:
>
> > Can someone please see what's wrong with this.
>
> > (defn getArg [arg]
> > "Return a [keyword value] depending on the
I have a java object that either contains a String or an array of Strings.
(instance? java.lang.String obj... works fine for the String,
but how would I check for the String Array?
Thanks, Adrian.
--~--~-~--~~~---~--~~
You received this message because you are s
The first regex is returning an empty list not nil.
David
On Mon, Mar 9, 2009 at 11:48 AM, timc wrote:
>
> Can someone please see what's wrong with this.
>
> (defn getArg [arg]
>"Return a [keyword value] depending on the form of the string arg:
>1. arg is of the form +x ==> [:x t
Hi,
$ time clojure euler43.clj
(1 4 0 6 3 5 7 2 8 9)
(1 4 3 0 9 5 2 8 6 7)
(1 4 6 0 3 5 7 2 8 9)
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid7476.hprof ...
The hprof file is 330mb in size, i can't read it with jhat (even if i
give it 1.5G ).
I assume perms is the pro
Can someone please see what's wrong with this.
(defn getArg [arg]
"Return a [keyword value] depending on the form of the string arg:
1. arg is of the form +x ==> [:x true].
2. arg is of the form -x ==> [:x false].
3. arg is of the form x=v ==> [:x v].
4. el
Ok, working on it.
Rich Hickey a écrit :
>
> On Mar 9, 5:04 am, Timothy Pratley wrote:
>
>> Hi Paul,
>>
>>
>>> I actually mentioned the cycle function in my message, and that's what
>>> I was using, but the original question came up because accessing the
>>> nth item in a list takes line
I do use this pattern, but if I were naming it I think I'd call it
"find-first". But that's scarcely shorter than "(first (filter ...)",
which is why I've never actually defined it.
-Stuart Sierra
On Mar 8, 3:20 pm, André Thieme wrote:
> I regularily stumble upon the (first (filter predicate co
My Clojure environment consists of an editor, 3 shell scrips, and
various jars. In general I strive for very simple setup that minimizes
that amount of state that I have to maintain during a development
session.
The editor I use is TextMate. This works well for me because it has
native Mac keybin
> Every launch of Clojure has the opportunity to specify a classpath to
> use. Since user.clj is loaded from classpath, it seems to me that's a
> sufficient mechanism to avoid loading a given user.clj for a given
> launch of Clojure.
Sure, I can definitely control the loading of user.clj
That's a great idea. I guess the easiest way to implement this is to
make it standard to include tags: at the top or bottom of a docstring:
(defn pmap
"tags: parallel, map
Blah blah blah."
...)
(find-doc "parallel")
---
(pmap ...)
tags: parallel, map
Blah blah blah.
That'd be a cool,
On Sun, Mar 8, 2009 at 9:28 PM, Rich Hickey wrote:
>
> On Mar 8, 6:17 am, David Powell wrote:
>> > Identity is tested first in equality, if identical, equal, full stop.
>>
>> That's what I'd assumed (it's what the JDK collections do), but
>> looking at the code, to say, APersistentVectory, I can
On Mar 9, 7:46 am, Rich Hickey wrote:
> On Mar 9, 2:19 am, Mark Engelberg wrote:
>
>
>
>
>
> > On Sun, Mar 8, 2009 at 10:44 PM, mikel wrote:
> > > Clojure doesn't have to provide these facilities (though I wouldn't
> > > mind if it did); it just needs to stay out of my way when I decide I
> >
On Mar 9, 5:04 am, Timothy Pratley wrote:
> Hi Paul,
>
> > I actually mentioned the cycle function in my message, and that's what
> > I was using, but the original question came up because accessing the
> > nth item in a list takes linear rather than constant time.
>
> Apologies for not reading
On Mon, Mar 9, 2009 at 7:13 AM, Timothy Pratley
wrote:
>
> Hi Mark,
>
> That's really handy!
>
> Java interop. - proxies
> Perhaps should also be tagged as "anonymous class instance"?
>
> I think super-categories would be useful :)
Agreed! We just have to come up with them.
> How are you record
On Mar 9, 2:43 am, mikel wrote:
> On Mar 9, 1:19 am, Mark Engelberg wrote:
>
> > On Sun, Mar 8, 2009 at 10:44 PM, mikel wrote:
> > > Clojure doesn't have to provide these facilities (though I wouldn't
> > > mind if it did); it just needs to stay out of my way when I decide I
> > > need to add
On Mon, Mar 9, 2009 at 4:03 AM, Tuomas J. Lukka wrote:
>
> In fact, how about adding tags to the actual docstrings of the
> functions? That way, this could be automatized in the future.
I suggested that a couple of months ago and didn't get any feedback. I
agree it would be a nice thing to do. I
Hi all,
I just thought I would share that I managed to get Gorilla working in
Windows by using special build of of Vim 7.2 with Ruby support by Wu
Yongwei. The page is linked to from the vim-online download. Here's
the link:
http://wyw.dcweb.cn/#download
It contains gvim.exe and vim.exe so I
On Mar 9, 2:19 am, Mark Engelberg wrote:
> On Sun, Mar 8, 2009 at 10:44 PM, mikel wrote:
> > Clojure doesn't have to provide these facilities (though I wouldn't
> > mind if it did); it just needs to stay out of my way when I decide I
> > need to add them.
>
> Yeah, as much as I like maps, I fe
Konrad, I wish you had used a normal Google account instead of one with your
personal email address--I didn't know Google allowed that, but or course
there's no changing the past commits now. Since Bitbucket is ignoring my
request to display email addresses the way Google Code does, I've made my
re
On Mar 8, 7:59 pm, Brian Carper wrote:
> On Mar 8, 10:53 am, Rich Hickey wrote:>
>
> > In looking at some of the libraries, I am a bit concerned that maps
> > are not being used when the logical entity is in fact a map.
>
> One time I find myself abusing vectors where maps would be better is
>
In fact, how about adding tags to the actual docstrings of the
functions? That way, this could be automatized in the future.
Tuomas
On Mar 9, 8:03 am, "Mark H." wrote:
> On Mar 8, 5:30 pm, Mark Volkmann wrote:
>
> > I made an attempt at categorizing all special forms, functions and
> > mac
Hi Mark,
That's really handy!
Java interop. - proxies
Perhaps should also be tagged as "anonymous class instance"?
I think super-categories would be useful :)
How are you recording these tags? It would be really nice if this info
could be available in a map from a clj file in contrib, that way
While using the code distributed with Stu Halloway's "Programming
Clojure" book I get the following exception from (read-line):
java.lang.ClassCastException:
clojure.lang.LineNumberingPushbackReader (NO_SOURCE_FILE:0)
So I downloaded the latest trunk from SVN, and (read-line) works
fine. Ho
Thanks for all the great suggestions. I do plan to do all of this.
1) Make the names links to their API documentation.
2) Add commas between names.
3) Add color-coding to visually distinguish between special-forms,
functions and macros.
4) Allow names to be in more than one category.
I'll send a
On Sun, Mar 8, 2009 at 9:59 PM, Brian Carper wrote:
>
> On Mar 8, 10:53 am, Rich Hickey wrote:>
>> In looking at some of the libraries, I am a bit concerned that maps
>> are not being used when the logical entity is in fact a map.
>
> One time I find myself abusing vectors where maps would be be
I'd suggest playing with much less complex classes for proxy first. A
very good place to start are ActionListeners from swing. This is a
really useful application of proxy - very necessary and practical...
and you only need to implement one function.
Regards,
Tim.
On Mar 9, 6:17 pm, Paul Moose
Hi Paul,
> I actually mentioned the cycle function in my message, and that's what
> I was using, but the original question came up because accessing the
> nth item in a list takes linear rather than constant time.
Apologies for not reading your post carefully. Indeed I think your
cyclic-vector
I feel I should clarify that I'm not trying to argue that a cyclic
vector is a great idea - it is something something I was playing with
in the midst of solving an euler problem. What I'm more interested in
is the question of how to accomplish this sort of thing ("proxying" an
existing instance, i
79 matches
Mail list logo