Caching Reflector.getMethods, as described below, works pretty well.
Performance seems acceptable for now. Startup time is still dramatic,
need to investigate. Considering releasing changes as a fork on
github is anybody is interested.
On Sat, Jan 31, 2009 at 8:35 PM, Remco van 't Veer wrote:
I got a 50% speedup using psort instead of sort with a compute-
intensive comparator and a 100 element sequence on a dual-core
machine.
That said, I found a faster way to do it: I separated the intensive
calculations from the comparator - just returning a numeric value. I
used pmap to get a seque
On Feb 3, 11:09 pm, Rich Hickey wrote:
> On Feb 3, 4:43 pm, Anand Patil
> wrote:
> No, it's not. as the docs for preduce say:http://clojure.org/api#preduce
>
> "Also note that (f base an-element) might be performed many times"
>
> in fact, an arbitrary number of times depending on how many pa
Streams were also intended for I/O. Is lazier addition also able to
cope with I/O sucessfully?
Can we have both - streams and lazy-seq?
My thought about streams is that if they get included, they could be
looked at as unsafe operations in Java/C# or unchecked math operations
- as long as programm
Thanks Stuart. Since the clojure-contrib.jar you built in step 3 does
include both clj and class files, I think you can reduce
(setq swank-clojure-extra-classpaths
(list "/Users/stuart/Projects/clj/contrib/src"
"/Users/stuart/Projects/clj/contrib/classes"))
to
(set
well, I found technomancy's update of clojure mode... there was
something very odd though.
each time I would 'git clone' it, I would end up with the jochu source
code instead... even though .git/config pointed to technomancy's
github location!
I had to manually download the .zip file and unpack
On Feb 4, 7:21 am, MikeM wrote:
> > Other than that, there is just the general loss of nil-punning. This
> > was the theoretical problem that kept me from making this tradeoff
> > earlier. I'm very much interesting in hearing from those for whom the
> > lazy branch represents a real problem due
I agree & don't mean to complain. I'm just flagging the issues to make
it easier for whoever goes through the docs after clojure 1.0 is
tagged.
Anand
On Feb 4, 9:45 am, Zak Wilson wrote:
> The namespace is correct on clojure.org/api, but there it doesn't
> mention that it has a dependency that
On Feb 4, 1:45 am, Mark Engelberg wrote:
> One thing I couldn't tell from the "lazier" doc is whether rest is
> only being kept around for backward compatibility or whether there
> still might be reasons to actively prefer rest to more.
rest is being kept for compatibility and ease of use. It
On Feb 4, 6:55 am, Frantisek Sodomka wrote:
> Streams were also intended for I/O. Is lazier addition also able to
> cope with I/O successfully?
Yes. After full laziness, most of the issues with I/O have to deal
with resource management, which I plan to deal with a la carte with
the scope const
On Feb 3, 10:44 pm, Jason Wolfe wrote:
> This just bit me a second time, since one of my revised set functions
> uses "contains?" and thus doesn't work on java.util.Sets (or even
> the .keySets of Clojure maps).
>
> user> (contains? (.keySet {:a :b}) :a)
> false
>
> It seems that all that's req
On Feb 3, 11:16 pm, "Stephen C. Gilardi" wrote:
> On Feb 3, 2009, at 10:44 PM, Jason Wolfe wrote:
>
> > user> (contains? (.keySet {:a :b}) :a)
> > false
>
> > It seems that all that's required to make "contains?" work on general
> > Sets is to replace "IPersistentSet" with "Set" on lines 648 an
Thanks Mark, Chouser,
I will update that section of the book with a corrected example in
Beta 7.
Cheers,
Stuart
>
> On Tue, Feb 3, 2009 at 11:26 AM, Mark Volkmann
> wrote:
>>
>> Now I remember what I was thinking about. This isn't so much a
>> difference between macros and functions as it is
On Feb 4, 9:03 am, MikeM wrote:
> > (if [] true false)
>
> > I'd hate to lose the ability to distinguish between an empty
> > collection and nothing.
>
> As a trade-off to allow nil-punning, you could stipulate the use of
> coll? in the above situation:
> (if (coll? []) true false) => true
> Th
> providing relations from clojure-sets and sql-queries.
Wow - this is really neat Erik - thanks for showing
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to cloj
Hi Brian,
On Feb 4, 2009, at 9:21 AM, BrianS wrote:
However, whenever I insert
a SQL query that contains an inner join command (standard SQL), I get
the following error:
java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.IllegalArgumentException: Too many arguments to struct
cons
On Feb 4, 10:12 am, "Remco van 't Veer" wrote:
> Caching Reflector.getMethods, as described below, works pretty well.
> Performance seems acceptable for now. Startup time is still dramatic,
> need to investigate. Considering releasing changes as a fork on
> github is anybody is interested.
>
I
On Feb 4, 9:19 am, Konrad Hinsen wrote:
> On 04.02.2009, at 14:03, Rich Hickey wrote:
>
> > 1) Resource management in lazy contexts
> > 2) Memory consumption in recursive lazy contexts (the filter retains
> > skipped range issue)
> > 3) Full laziness in I/O and other side-effect contexts, and f
On Feb 4, 2009, at 9:46 AM, Stephen C. Gilardi wrote:
That sounds like what's going on in your example. Can you please
confirm?
Also, if you have one handy, could you please send me a short,
standalone example of code that triggers the problem? I'd like to look
at how clojure.contrib.sql
On 04.02.2009, at 15:03, MikeM wrote:
> This seems less burdensome - fewer cases where I'd need to do this vs
> (if (seq s) ...
A slightly off-topic comment: I wonder why the (if (seq s)...) idiom
is so important. It is completely unintellegible to a reader who is
not aware of the idiomatic
Steve,
Big apologies, I should have done just a little more investigating
before posting. I serve as my team's DBA, so I should rightfully
abhor the "SELECT * ", but that is what was causing the
problem:duplicate column names in the returnset, as you said above.
Once I substituted actual
colum
>
> (if [] true false)
>
> I'd hate to lose the ability to distinguish between an empty
> collection and nothing.
>
As a trade-off to allow nil-punning, you could stipulate the use of
coll? in the above situation:
(if (coll? []) true false) => true
This seems less burdensome - fewer cases where I
>
> Other than that, there is just the general loss of nil-punning. This
> was the theoretical problem that kept me from making this tradeoff
> earlier. I'm very much interesting in hearing from those for whom the
> lazy branch represents a real problem due to loss of nil punning.
>
To preserve n
On 04.02.2009, at 14:03, Rich Hickey wrote:
> 1) Resource management in lazy contexts
> 2) Memory consumption in recursive lazy contexts (the filter retains
> skipped range issue)
> 3) Full laziness in I/O and other side-effect contexts, and for ease
> of understanding
> 4) Performance/elegance
The namespace is correct on clojure.org/api, but there it doesn't
mention that it has a dependency that isn't included with Clojure.
Clojure has been evolving very quickly, and sometimes the website
doesn't keep up. It might be nice if somebody could take charge of
making sure the site is up to d
As we never can have enough examples, and this one was about the
simplest that just worked on Ubuntu, I'll paste my variant of it here.
It is slightly different because I'm behind a proxy, and thus my git
calls are somewhat different, and I got my slime from a git repository
rather than a cvs one.
Marde, Feb 3, 2009 at 14:24, Konrad Hinsen skribis:
[...]
> I can't think of anything that would be "forbidden" in a macro but
> "allowed" in a plain function. There are many things that don't make
> sense in a macro, of course: launching agents, opening windows, ...
Well, for normal functions y
This may be a duplicate post, if so I apologize. I am having a problem
while investigating the inner workings and capabilities of the
clojure.contrib.sql class, specifically with the "inner join" syntax.
I have a function that returns recordset maps that is taken directly
from the test.clj file in
2009/2/3 AndrewC. :
[...]
> The people at Scheme UK have (very) occasional meetings in Shoreditch.
> We could join up with them and get a few more people, perhaps.
>
> http://upcoming.yahoo.com/group/4654/
>
> Perhaps someone could do an introductory talk 'Clojure for Schemers'
> and then move on
Having a lisp to do android app development is definately worth some efford.
Kawa already has some android support in svn trunk but it doesn't seem in a
usable state; my experiments break because a lot of expressions do not seem
to compile AOT. The parts that do compile are very fast on the other h
Personally I find that the clearest way to think about macros, is to
treat them like a *very* advanced search-and-replace feature.
Just keep in mind that macros expand into code, and check to make sure
that your generated code is indeed valid code.
--~--~-~--~~~---~--~-
(defn foobar [#^MyClass[] myarray])
This syntax doesn't seem to work.
--~--~-~--~~~---~--~~
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
David Nolen a écrit :
> (defn foobar [#^MyClass[] myarray])
>
> This syntax doesn't seem to work.
Indeed it's a bit tricky:
#^"[Lyour.package.YourClass;"
You can find it by doing:
user=> (class (into-array [(your.package.YourClass.)]))
[Lyour.package.YourClass;
Christophe
--
Professional: http
> On Feb 3, 11:16 pm, "Stephen C. Gilardi" wrote:
>> On Feb 3, 2009, at 10:44 PM, Jason Wolfe wrote:
>>
>>> user> (contains? (.keySet {:a :b}) :a)
>>> false
>>
>>> It seems that all that's required to make "contains?" work on
>>> general
>>> Sets is to replace "IPersistentSet" with "Set" on lin
Hello Tim,
> Feel free to use it as you wish.
I have added the code (with attribution) to the guide.
Also, the .java generated code listing should now compile.
Updated guide is now on the same locations (including the files
section of this group).
>... So calling
> MainFrame.main() runs the
Many thanks.
On Wed, Feb 4, 2009 at 12:49 PM, Christophe Grand wrote:
>
> David Nolen a écrit :
> > (defn foobar [#^MyClass[] myarray])
> >
> > This syntax doesn't seem to work.
> Indeed it's a bit tricky:
> #^"[Lyour.package.YourClass;"
>
> You can find it by doing:
> user=> (class (into-array [
Hi,
Am 04.02.2009 um 05:24 schrieb Tom Faulhaber:
Meikel Brandmeyer has been doing some work on one. Check it out at:
http://kotka.de/projects/clojure/parser.html.
I haven't looked at it too closely myself. Maybe Meikel will stop in
and give you a feeling for how close/far it is from full Pars
I just wanted to point out that ' is syntactic sugar for (quote) not (list).
(list) will evaluate your arguments, where as '() will not. So if you try to
use them interchangeable you'll run into trouble.
user> (list 1 2 (+ 1 2))
(1 2 3)
user> '(1 2 (+ 1 2))
(1 2 (+ 1 2))
Its a pretty common lisp
On Feb 4, 5:33 am, Rich Hickey wrote:
> On Feb 3, 10:44 pm, Jason Wolfe wrote:
>
> > This just bit me a second time, since one of my revised set functions
> > uses "contains?" and thus doesn't work on java.util.Sets (or even
> > the .keySets of Clojure maps).
>
> > user> (contains? (.keySet {:a
Seeing all these complicated steps that need to be reproduced made me
wonder if it couldn't be automated. I've added an M-x clojure-install
command to my fork of clojure-mode, so if you are wanting to get started
with SLIME and Clojure, please give it a look.
Installation and configuration shoul
AFAICT, Datalog only supports the closed-world assumption. Does
anyone prefer an open-world assumption reasoner? In my opinion, they
are significantly more powerful.
On Feb 4, 6:16 am, Timothy Pratley wrote:
> > providing relations from clojure-sets and sql-queries.
>
> Wow - this is really ne
On Feb 3, 2009, at 9:42 PM, sbkogs wrote:
>
> Parsec is a very powerful parsing library for Haskell. I was mainly
> attracted to Haskell because of this library (ala Pugs project which
> used Parsec to create a Perl6 parser).
>
> I am wondering if there is an ongoing effort to write similar lib
On Feb 4, 2:42 am, sbkogs wrote:
> If anybody is working on similar library, please drop me a line. I
> have some bandwidth to spend towards such work/fun.
I created some simple LL parser tools for my Rend library:
http://github.com/weavejester/rend/blob/43f882a9474fb8662007e5a5d0c50648fc0caa7
I'm having a problem that appears tied to this aspect of the guide
(written for Linux):
>> Before continuing, symlink build/classes/gui into the test-project directory
>> (note, there is a “.” as the last character in the 2nd command):
cd ~/test-project
ln -s build/classes/gui/ . // no
Take a look at:
http://clojure.googlegroups.com/web/monad-parser.clj
It's the code from "Monadic Parsing in Haskell" written in Clojure.
It'd have to be modified slightly to work with the new
clojure.contrib.monads. But that would be easy to do.
jim
On Feb 3, 8:42 pm, sbkogs wrote:
> Parsec
On Feb 4, 5:39 am, Rich Hickey wrote:
> On Feb 3, 11:16 pm, "Stephen C. Gilardi" wrote:
>
> > On Feb 3, 2009, at 10:44 PM, Jason Wolfe wrote:
>
> > > user> (contains? (.keySet {:a :b}) :a)
> > > false
>
> > > It seems that all that's required to make "contains?" work on general
> > > Sets is to
I'm having a problem that shows as:
java.lang.ClassNotFoundException: gui2.MainFrame
java.lang.ClassNotFoundException: gui2.MainFrame
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.f
(defun get-classpath-list ()
(if
(or
(eq 'windows-nt system-type)
(eq 'ms-dos system-type))
(split-string (getenv "CLASSPATH") ";")
(split-string (getenv "CLASSPATH") ":")))
(setq swank-clojure-jar-path
(dev-dir "clojure/clojure.jar"))
(setq swank-clojure-ext
Also, I would love to get some more debugging support into slime.
I was wondering how difficult it would be to use the java debugging
API, embedded in the swank module, and send debug commands across?
Chris
On Feb 4, 2:36 pm, chris wrote:
> (defun get-classpath-list ()
> (if
> (or
>
Hi
On Wed, Feb 4, 2009 at 10:54 PM, AlamedaMike wrote:
>
> I'm having a problem that appears tied to this aspect of the guide
> (written for Linux):
>
>>> Before continuing, symlink build/classes/gui into the test-project
>>> directory (note, there is a "." as the last character in the 2nd comm
I want to test if a certain function prints a certain message to the
system's standard output. How may I go about doing this?
(defn printing-fn []
(print "YES"))
(deftest test-printing-fn
(some-context-that-switches-the-default-target-of-printing
(printing-fn)
(is (= the-standard-out
On Wed, Feb 4, 2009 at 12:49 PM, Christophe Grand wrote:
>
> David Nolen a écrit :
>> (defn foobar [#^MyClass[] myarray])
>>
>> This syntax doesn't seem to work.
> Indeed it's a bit tricky:
> #^"[Lyour.package.YourClass;"
>
> You can find it by doing:
> user=> (class (into-array [(your.package.Yo
Hello,
this should work for you :
(binding [*out* (java.io.StringWriter.)]
(printing-fn)
(= (.toString *out*) "YES"))
Regards,
--
Laurent
2009/2/4 samppi
>
> I want to test if a certain function prints a certain message to the
> system's standard output. How may I go about do
chris writes:
> (defun get-classpath-list ()
> (if
> (or
>(eq 'windows-nt system-type)
>(eq 'ms-dos system-type))
> (split-string (getenv "CLASSPATH") ";")
> (split-string (getenv "CLASSPATH") ":")))
>
> (setq swank-clojure-jar-path
> (dev-dir "clojure/clo
Hi,
Am 04.02.2009 um 23:01 schrieb Laurent PETIT:
this should work for you :
(binding [*out* (java.io.StringWriter.)]
(printing-fn)
(= (.toString *out*) "YES"))
There is also with-out-str:
(= "YES" (with-out-str (printing-fn)))
(And for the record: there is also a with-in-st
Well, Datalog does give you guaranteed termination, so there is that,
although its bottom-up strategy is A LOT harder to implement (I'm now
trolling trough about a billion journal articles on "magic sets" and
so on to try to fix this).
I expect to provide full-on evaluable predicates, which I bel
Guaranteed-termination is very desirable. However, you can have guaranteed
termination with an open-world assumption just as well. And I think an
open-world assumption does a better job of mimicking human reasoning.
On Wed, Feb 4, 2009 at 2:16 PM, Jeffrey Straszheim <
straszheimjeff...@gmail.com
> java.lang.ClassNotFoundException: gui2.MainFrame
To resolve gui2.MainFrame there needs to be MainFrame.class, in
directory gui2, in the current class-path.
Please check:
1) The directory name matches the namespace (If you can't get mklink
working, maybe just copy it instead?)
2) The current dir
Sorry for jumping in, but
"#^#=" doesn't make any sense to me. Where did this come from?
Chris
On Feb 4, 2:55 pm, Chouser wrote:
> On Wed, Feb 4, 2009 at 12:49 PM, Christophe Grand
> wrote:
>
> > David Nolen a écrit :
> >> (defn foobar [#^MyClass[] myarray])
>
> >> This syntax doesn't seem
On Feb 4, 2009, at 11:09 AM, BrianS wrote:
Once I substituted actual column names in the SELECT portion of the
statement, the inner joins started working as they should.
Excellent!
As always, thanks for the attention, assistance, and the original
work in clojure.contrib.sql, it has all be
On Wed, Feb 4, 2009 at 6:22 PM, chris wrote:
>
> "#^#=" doesn't make any sense to me. Where did this come from?
I already apologized twice, what more do you want from me!?
As penance, I will try to explain.
#^ is a reader macro, documented at http://clojure.org/reader
#= is another reader ma
Is there an easy way to create custom exception classes. Like in Java
where you do:
public class MyOwnException {}
I suppose there is a way to do it with gen-class, but gen-class looks
complicated.
Can someone post a simple example?
(btw, this would make a great macro in clojure.contrib. I'
Michael, Timothy,
Thanks much to both of you.
>> 2) The current directory (parent of gui2) is in the class-path -cp
option when launching Clojure
The problem was that I had used the gui directory in the classpath,
rather than its parent. (The real problem is that I'm a Java noobie.)
The frame
>> The quote symbol rendered is not copy+paste friendly.
The quote problem can be fixed by using:
(import (quote (gui2 MainFrame)))etc...
instead of using the single quote mark.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
It is useful to build a map from a list of keys and a value generator
function. Of Course, such a function is easy to write:
(defn genmap [keys fun]
(zipmap keys (map fun keys)))
In fact, it seems so useful that it must be in the standard API
somewhere, but I can't find it... did I miss it som
Hi,
Have some difficulties in reasoning about it.
>From ants.clj,
(def board
(apply vector
(map (fn [_]
(apply vector
(map (fn [_] (ref (struct cell white)))
(range dim
(range dim
Is there any sim
> C:\Users\Mike\Documents\test-project>c:\clojure\clj.bat app.clj
> Exception in thread "AWT-EventQueue-0" java.io.IOException: Stream
> closed
The reason you are seeing this is that stdout has closed when the main
clj program reaches the end, but the Swing thread is still running. I
remember ha
Awesome. Thanks for the answers, everyone.
On Feb 4, 3:07 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 04.02.2009 um 23:01 schrieb Laurent PETIT:
>
> > this should work for you :
>
> > (binding [*out* (java.io.StringWriter.)]
> > (printing-fn)
> > (= (.toString *out*) "YES"))
>
> The
You have to build a class with gen-class.
Here's an example:
---
(ns com.infolace.format.InternalFormatException
(:gen-class
:extends Exception
:init init
:constructors { [ String Integer ] [ String ] }
:state pos))
(defn- -init [
are they really equivalent?
Looks like they are but...
Also I was trying to decompose...
user=> (def x (apply vector (map (fn [_] 1) (range 3
#'user/x
user=> x
[1 1 1]
user=> (apply vector (map (fn [_] x) (range 3)))
[[1 1 1] [1 1 1] [1 1 1]]
and now it makes a lot more sense...
On Feb 5,
Samppi -
On Jan 28, 12:53 pm, samppi wrote:
> Thanks for the replies, everyone. I read in an article that one of the
> most common Swing mistakes is putting non-GUI work into the event
> dispatch thread, but it seems like oftentimes the cost of creating a
> new thread outweighs the benefit of s
Samppi -
On Jan 28, 12:53 pm, samppi wrote:
> Thanks for the replies, everyone. I read in an article that one of the
> most common Swing mistakes is putting non-GUI work into the event
> dispatch thread, but it seems like oftentimes the cost of creating a
> new thread outweighs the benefit of s
Here's what I came up with: is it any clearer?
(def board
(vec (for [i (range dim)]
(vec (for [j (range dim)]
(ref (struct cell white)))
On Feb 4, 11:30 pm, wubbie wrote:
> Hi,
>
> Have some difficulties in reasoning about it.
> From ants.clj,
> (def boar
Let's say I want to make a small parser for a small language. The
language is made up of values of two kinds: arrays and bits. An array
can only be of the form "[x,y]", where x and y are values. A bit can
only be of the form "0" or "1". In other words, the language's strings
can look like this:
-
Chouser a écrit :
> (defn foobar [#^#=(array-of MyClass) myarray])
>
> Again, I apologize for even suggesting this
Wow what a clever (ab)use of reader macros!
--
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)
--~--~-~--~~~---~--~
Where did 'ref' go in your own implementation?
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
Wow, thanks wwmorgan! I too was struggling to have some semblance of
intuition on the first form, but this one is much easier.
Duane
On Feb 4, 10:19 pm, wwmorgan wrote:
> Here's what I came up with: is it any clearer?
>
> (def board
> (vec (for [i (range dim)]
> (vec (for [j (ran
How do you write a unicode character in clojure?
Or properly put: what form do you provide the reader so that it
produces a unicode character as data structure?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Cloju
I got some help from hiredman in the IRC channel -
http://github.com/metaperl/begin-clojure/blob/619eb489fb68839d2376d2cdf7375f2370d38494/1/unicode-chars.txt
On Feb 5, 2:24 am, Terrence Brannon wrote:
> How do you write a unicode character in clojure?
>
> Or properly put: what form do you provi
79 matches
Mail list logo