In Scheme, the common scheme used to name functions with side effects
is to append an exclamation mark to the function name. Obviously, the
types of ways in which Clojure abstracts state modifications are more
complicated and complete than Scheme, so maybe a function naming
scheme for Clojure fun
Thanks.
(BTW, the other day some friends made fun of me because I didn't yet use
git.)
On Wed, Feb 11, 2009 at 11:07 PM, Stephen C. Gilardi wrote:
>
> On Feb 11, 2009, at 10:57 PM, Jeffrey Straszheim wrote:
>
> I know I should look this up on the web, but I'm really busy these days. I
> do inte
On Feb 11, 2009, at 10:57 PM, Jeffrey Straszheim wrote:
I know I should look this up on the web, but I'm really busy these
days. I do intend to learn git someday, but I'm doing fine with
Subversion for my own work. However, a lot of you are distributing
your libs in git.
So, can you gi
I know I should look this up on the web, but I'm really busy these days. I
do intend to learn git someday, but I'm doing fine with Subversion for my
own work. However, a lot of you are distributing your libs in git.
So, can you give me a quick pointer on how to do two things:
1. Check out someo
I just took a quick look at the java.awt.EventQueue class where the dispatch
thread is managed, and I could see no obvious place you could hook in your
own calling code, which you'd need to wrap it with a (binding ...) form.
If you really want to hack the system, look at the code in core.clj for
b
I'd love to add Clojure-Datalog. I'm still working on it, but it now
implements complete Datalog rules, including stratified negation and
boolean filters. It can now be used for basic tasks, although the
interface is rough.
Name: Clojure-Datalog
http://code.google.com/p/clojure-datalog/
Jeffrey
def doesn't create a thread-local binding, it creates a var within a
particular namespace -- the binding form is what established the
thread-local binding. So, when used on the AWT/Swing thread,
(binding [*my_environment* (new_environment)]
...)
will execute the body of the binding form
Point taken.
The time when it the exception trace becomes annoying is when you're
doing TDD and you start with lots of broken tests.
The other time is pretty much any Clojure stack trace when you're
developing. In most cases, the bug is in your own code but your own
code only represents a tiny p
Hi,
I just wrote a library that creates an un-initialized global variable,
and requires the user to create his own thread-local binding in order
to run it.
eg.
(def *my_environment*)
...
and the user would use it like so:
(binding [*my_environment* (new_environment)]
(start_engine_thread))
An
Jason Wolfe writes:
> OK, fine. Any objections to "shuffle" and "rand-elt", to parallel "rand-int"?
I think that the bike shed should definitely be red.
=)
-Phil
(http://en.wikipedia.org/wiki/Color_of_the_bikeshed)
--~--~-~--~~~---~--~~
You received this mes
Very cool, I like it a lot so far! Thanks, Mark.
-Jason
On Jan 19, 7:02 pm, Mark Fredrickson
wrote:
> 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 in
OK, fine. Any objections to "shuffle" and "rand-elt", to parallel
"rand-int"?
On Feb 11, 2009, at 3:42 PM, Jeffrey Straszheim wrote:
> "shuffle" seems perfectly fine. We *know* you aren't modifying it
> in place, after all.
>
> Is there any reason we can't name random-element something lik
Hi,
I have just read about the upcoming JDK 6u14 [1], which mentions that
one of the features is support for loading anonymous classes [2].
Is this being considered for Clojure? I couldn't really extract from
the article whether this is backwards-compatible or how much overhead
it is to maintain
> Patch welcome, if you've all come to a conclusion.
Attached to original issue
http://code.google.com/p/clojure/issues/detail?id=23
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this g
"shuffle" seems perfectly fine. We *know* you aren't modifying it in place,
after all.
Is there any reason we can't name random-element something like random-elem
? I think that is a fine compromise.
On Wed, Feb 11, 2009 at 6:37 PM, Jeff Valk wrote:
>
> - Original Message -
> From: Ph
- Original Message -
From: Phil Hagelberg
Sent: Wednesday 11 February 2009 13:16
>
> Jason Wolfe writes:
>
> >> Would you consider changing the names of these 2 functions ?
> >>
> >> random-permutation -> shuffle
> >> random-element -> one-of
> >>
> >> Shorter names are a trademark of
thanks Meikel,
I'll have a look.
Cheers,
sun
On Feb 11, 6:09 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 11.02.2009 um 23:59 schrieb wubbie:
>
> > In some post Rich recommended:
> > (let [z (ref 0)]
> > (defn add2 [] (dosync (alter z #(inc %)
>
> Just a sidenote: You don't need #(inc %).
On Feb 8, 2009, at 5:18 PM, Mark Volkmann wrote:
The second argument to the with-query-results macro needs to be a
vector containing a query string and optional values to be inserted
into the query if it is parameterized. Would it be difficult to change
this so in the case that the query is not
Hi,
Am 11.02.2009 um 23:59 schrieb wubbie:
In some post Rich recommended:
(let [z (ref 0)]
(defn add2 [] (dosync (alter z #(inc %)
Just a sidenote: You don't need #(inc %). inc alone
is perfectly sufficient.
(let [z (ref 0)]
(defn add2
[]
(dosync (alter z inc
Then
Is
Hi,
In some post Rich recommended:
(let [z (ref 0)]
(defn add2 [] (dosync (alter z #(inc %)
instead of
(let [z (ref 0)]
(defn add2 [] (dosync (refset z (inc @z) ; !!! deref @z again
Then
Is there any way not to deref again for this? It's from ants.clj
(alter oldp assoc :phe
Jason Wolfe wrote:
> You're right, they should probably live in seq_utils.clj instead.
> I'll post an issue to move them.
>
> If anyone has strong feelings about names, now would be a good time to
> air them. My inclination is to leave the names as they are now; while
> "shuffle" is the na
Hi,
Am 11.02.2009 um 23:08 schrieb what-a-guy:
How would I code the following in clojure?
JTable table = new JTable(new MyTableModel()) {
...
//Implement table header tool tips.
protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
You're right, they should probably live in seq_utils.clj instead.
I'll post an issue to move them.
If anyone has strong feelings about names, now would be a good time to
air them. My inclination is to leave the names as they are now; while
"shuffle" is the name for the Java "random-permut
OK. Let me try that.
On Feb 11, 11:09 pm, Shawn Hoover wrote:
> On Wed, Feb 11, 2009 at 3:10 PM, Harrison Maseko wrote:
>
> > Hi everyone,
> > I just downloaded Clojure Box today and tried to run the example found
> > athttp://clojure.org/jvm_hostedand I get the error below. What is
> > the pro
How would I code the following in clojure?
JTable table = new JTable(new MyTableModel()) {
...
//Implement table header tool tips.
protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
public String getToolTipText(MouseEvent e)
I was a bit surprised that random-permutation is in lazy-seqs.. there
doesn't seem to be much lazy about it, right? It is just java's
shuffle.
On Feb 11, 8:16 pm, Phil Hagelberg wrote:
> Jason Wolfe writes:
> >> Would you consider changing the names of these 2 functions ?
>
> >> random-permutat
On Feb 10, 11:18 pm, Mark Engelberg wrote:
> I was the source of this error, and I agree that the behavior is an
> error. I missed the case of a negative divisor and a 0 remainder
> among my test cases for the mod function.
>
> Thanks for noticing and fixing the problem.
>
> Although Chouser's
Just started using it. I had some trouble understanding the whole java
classpath and jar concept, but I'm now happily producing graphs. Will
start using it tomorrow for some population data, and expand it as I
need :).
On Jan 21, 12:35 am, "Tom Ayerst" wrote:
> Mark,
>
> Thanks for doing this, I
On Wed, Feb 11, 2009 at 3:10 PM, Harrison Maseko wrote:
>
> Hi everyone,
> I just downloaded Clojure Box today and tried to run the example found
> at http://clojure.org/jvm_hosted and I get the error below. What is
> the problem?
> Harrison
>
> java.lang.Exception: Unable to resolve symbol: setL
Hi everyone,
I just downloaded Clojure Box today and tried to run the example found
at http://clojure.org/jvm_hosted and I get the error below. What is
the problem?
Harrison
java.lang.Exception: Unable to resolve symbol: setLayout in this
context (NO_SOURCE_FILE:17)
[Thrown class clojure.lang.C
On Feb 11, 10:55 am, Jeffrey Straszheim
wrote:
> So, ensure can make you rollback if the value is not current when you
> commit. Can it make other transactions rollback if you've ensured a ref,
> and commit before them?
>
No. That's what I meant to imply by (b). ensure has no effect on other
On Feb 11, 12:58 pm, Stuart Halloway
wrote:
> Hi Berlin,
>
> Your testDog needs a 'this' argument:
>
> (defn -testDog [this]
> (println "Dog called on " this))
>
> I played with generating JUnit classes when I started writing the
> book, and unless you have a specific need I would recommend u
Nice work!
Two things related to 'strcat'.
1) This is already implemented as clojure.core/str (and is more
efficient than concat'ing)
2) This function is never called :)
I have some idea's related to the presentation, but I don't have time
to iterate them right now.
-Ryan
On Feb 11, 8:29 am,
On Feb 5, 1:52 am, David wrote:
> I've got the same problem assrolls24and CuppoJava on Windows XP,
> using Emacs 23
> and versions of Clojure, Slime and Swank fetched today.
>
> Also, when starting Slime, it opens a connection to *inferior-lisp*,
> but keeps polling
> for Swank until I hit return
Hi Christophe,
I am trying out Enlive and had some questions regarding it's feature
set and your future plans in terms of functionality.
1) Component Templates
I was wondering if you had any plans to support component templates?
I.e., templates that represent just a portion of a page (via an htm
Jason Wolfe writes:
>> Would you consider changing the names of these 2 functions ?
>>
>> random-permutation -> shuffle
>> random-element -> one-of
>>
>> Shorter names are a trademark of clojure.
>> "one-of" was taken straight from paip =)
>
> I'd be OK with shuffle, I guess, but I don't know if
> Would you consider changing the names of these 2 functions ?
>
> random-permutation -> shuffle
> random-element -> one-of
>
> Shorter names are a trademark of clojure.
> "one-of" was taken straight from paip =)
I'd be OK with shuffle, I guess, but I don't know if one-of is
descriptive enough
Hi Berlin,
Your testDog needs a 'this' argument:
(defn -testDog [this]
(println "Dog called on " this))
I played with generating JUnit classes when I started writing the
book, and unless you have a specific need I would recommend using
something like test-is for Clojure testing.
Cheers,
On Feb 11, 12:39 pm, BerlinBrown wrote:
> On Feb 11, 12:21 pm, Stuart Sierra
> wrote:
>
> > On Feb 11, 11:46 am, BerlinBrown wrote:
>
> > > (defn -init [] ())
>
> > > (defn -testDog []
> > > (println "Dog"))
>
> > There's your problem: Java methods always need an extra first
> > argument, t
On Feb 11, 12:21 pm, Stuart Sierra
wrote:
> On Feb 11, 11:46 am, BerlinBrown wrote:
>
> > (defn -init [] ())
>
> > (defn -testDog []
> > (println "Dog"))
>
> There's your problem: Java methods always need an extra first
> argument, the object on which the method was called. It's like the
>
On Feb 11, 11:46 am, BerlinBrown wrote:
> (defn -init [] ())
>
> (defn -testDog []
> (println "Dog"))
There's your problem: Java methods always need an extra first
argument, the object on which the method was called. It's like the
"this" keyword in Java.
-Stuart Sierra
--~--~-~--~---
On Feb 11, 11:56 am, ".Bill Smith" wrote:
> Is it fair to say you really want to use Junit rather than the test
> framework in clojure-contrib? I can think of reasons why you might
> want to use Junit but I don't want to put words in your mouth.
>
> Bill
"I am trying to use Junit to generate
+1 for something like (let->).
I don't imagine myself being confused by the reserved symbol being
bound to different values in each successive form, or, in any case,
would gladly trade that possibility for the advantage of being able to
place the special symbol anywhere in the forms.
Somewhat al
Is it fair to say you really want to use Junit rather than the test
framework in clojure-contrib? I can think of reasons why you might
want to use Junit but I don't want to put words in your mouth.
Bill
--~--~-~--~~~---~--~~
You received this message because you
I asked this on IRC yesterday. I think Chouser had a good suggestion
but I forgot what it was.
I am trying to use Junit to generate tests with Clojure. May not be
the best to use junit but I was going to try anyway.
main.clj:
(compile 'test.OctaneTestGen)
(ns test.OctaneTestGen
(:gen-cla
So, ensure can make you rollback if the value is not current when you
commit. Can it make other transactions rollback if you've ensured a ref,
and commit before them?
On Wed, Feb 11, 2009 at 7:52 AM, Rich Hickey wrote:
>
>
>
> On Feb 10, 10:26 pm, Jeffrey Straszheim
> wrote:
> > Since we're on
There are quite a few ways to do what you're describing (and no particular
prescribed way). You want to look at multimethods and tag hierarchies.
http://clojure.org/multimethods
Tags can have multiple parents.
I'm working on a project called Spinoza (search the mailing list for that
and CLJOS) w
I can see arguments either way. Certainly for the core library, short names
are a plus. We don't want to litter our code with (get-first-element-of-seq
x), but for less common routines from the libraries, the longer names may
help readability a lot.
On Wed, Feb 11, 2009 at 6:46 AM, Phlex wrote:
Awesome! Thanks.
On Wed, Feb 11, 2009 at 4:01 AM, Konrad Hinsen wrote:
>
> On 10.02.2009, at 19:18, Jeffrey Straszheim wrote:
>
> > I suggested the following changed to letfn:
> >
> > http://code.google.com/p/clojure-contrib/issues/detail?id=26
> >
> > and have been informed that you manage th
On Wed, Feb 11, 2009 at 10:46 AM, Jesse Aldridge
wrote:
>
> I notice the front page of the wiki has had some changes awaiting
> review:
> http://en.wikibooks.org/wiki/Clojure_Programming
>
> Apparently they've been waiting for almost a month now?
>
> I also noticed this comment on the discussion
Spotted an error in clojure-mode.el. Swank-clojure-extra-classpaths
needs to be changed from this to the following, in order for people to
be able to use contrib.
(setq swank-clojure-jar-path (concat clojure-src-root "/clojure/
clojure.jar")
swank-clojure-extra-classpaths
(list
According to the GHC documentation [1]:
rem :: a -> a -> a
integer remainder, satisfying (x `quot` y)*y + (x `rem` y) == x
mod :: a -> a -> a
integer modulus, satisfying (x `div` y)*y + (x `mod` y) == x
div truncates toward negative infinity while quot (which is in
Clojure) truncates toward 0.
As I mentioned previously, I'm going to see if I can get time this
week to set it up to go through clojure.contrib.prxml. If I don't run
into any issues, that will remove the dependency on the javax stuff
I'm importing. It will have the additional benefit of cutting the code
in half. I'll update h
> I like it a lot. I think it would be very cool if such an HTML file covering
> clojure-rooted and clojure-contrib-rooted namespaces were to become an
> output of building clojure-contrib.
I like that idea a lot.
> Please consider whether or not you'd like to send in a Contributor Agreement
> t
So a FAQ it was, and not an old one with that ;) Thanks a lot !
On 10 fév, 23:38, Timothy Pratley wrote:
> Hi PH,
>
> > "Returns a map of the elements of col to the evaluation of function
>
> (zipmap keys (map fun
> keys))http://groups.google.com/group/clojure/browse_thread/thread/8fe99ca56..
On Feb 11, 4:36 am, "Remco van 't Veer" wrote:
> On Tue, Feb 10, 2009 at 1:57 PM, Remco van 't Veer wrote:
>
>
>
> > On Tue, Feb 10, 2009 at 1:33 PM, Rich Hickey wrote:
> >> On Feb 10, 3:47 am, "Remco van 't Veer" wrote:
> >>> Hi Rich,
>
> >>> I've been working on getting clojure in a more u
On Feb 6, 2009, at 8:45 AM, Laurent PETIT wrote:
Hello,
Does it also mean that the following use case will work with *reload-
all* :
- x.y.z is a lib that is made of two files : x/y/z.clj, and x/y/
z1.clj , and z.clj loads z1.clj
- x.y.z is compiled
- z1.clj is modified
- x.y.z is compile
On Feb 11, 2009, at 13:07, Christian Vest Hansen wrote:
>> I suppose I need to add javax.xml to my classpath, but where do I get
>> it from? I searched a bit and it looks like this is in the standard
>> Java distribution, but in which jar file?
>
> It was added in Java 6. Could you perchance be r
On Jan 29, 10:36 am, kyle smith wrote:
> I have improved on chouser'sgviewcode (http://blog.n01se.net/?
> p=30). It can now expand java.awt.Container objects.
Just for kicks I've expanded to handle Exceptions
http://groups.google.com/group/clojure/web/gview.clj
user=> (gview/gview *e)
Of cour
>
> Success! Thank you.
Success lasted till I tried to restart emacs. Here is where I am stuck
again:
1. It can't find M-x slime
clojure-slime-config doesn't seem to be an option either to manually
run with M-x clojure
The solution seems to be to take the functions in clojure-slime-config
and pu
On Feb 10, 10:26 pm, Jeffrey Straszheim
wrote:
> Since we're on the subject, what exactly does ensure *do* that simply
> reading the ref does not? And then, how does it differ from writing.
>
If you merely read a ref in a transaction that won't prevent another
transaction from changing it. (Y
Tim Martin wrote:
> Hi all,
> ...
>
The JDialog contructor takes a parameter that will tell it to be a modal
window.
(ns cara.gui.dialog-test
(:import [javax.swing JDialog JTextField JButton AbstractAction]))
(defn- create-and-show [data-ref]
(let [dialog (new JDialog (@data-ref :owner)
On Feb 10, 10:46 pm, Rayne wrote:
> I literally asked this same question yesterday in #Clojure. The answer
> is and
>
> user/ (doc and)
> -
> clojure.core/and
> ([] [x] [x & rest])
> Macro
> Evaluates exprs one at a time, from left to right. If a form
> returns logical
On Wed, Feb 11, 2009 at 11:58 AM, Konrad Hinsen
wrote:
>
> On Feb 10, 2009, at 18:02, Craig Andera wrote:
>
>> One of the challenges with learning any new platform is learning the
>> libraries. As a way to improve both that an my knowledge of Clojure
>> itself, I whipped together doc-browse, a Cl
Jason Wolfe wrote:
> Not yet, but perhaps soon. Code is here:
>
> http://code.google.com/p/clojure-contrib/issues/detail?id=8
>
> -Jason
>
Would you consider changing the names of these 2 functions ?
random-permutation -> shuffle
random-element -> one-of
Shorter names are a trademark of c
On Feb 10, 2009, at 4:15 PM, Chouser wrote:
>
>
> (defn mod42
> "Modulus of num and div. Truncates toward negative infinity."
> [num div]
> (if-not (and (integer? num) (integer? div))
>(throw (IllegalArgumentException. "mod requires two integers"))
>(let [m (rem num div)]
> (if (o
Thanks for the pointer
Different strokes for different folks, I guess. Any time I've had a
tool try to be smart with what error information is being provided, I
end up discovering that an important tidbit was being elided (usually
for some hours while tracking down a bug). Exceptions
I'm not sure I would call that a mixin -- really, all that's going on
is Python is allowing you to call any function, anywhere. In a
language like Scala that does have what I'd consider "real" mixins
(traits over there), then on_key_down would become a function
available in TableWidget's
On Feb 10, 2009, at 18:02, Craig Andera wrote:
> One of the challenges with learning any new platform is learning the
> libraries. As a way to improve both that an my knowledge of Clojure
> itself, I whipped together doc-browse, a Clojure library that will
> spit out an HTML page that contains do
Added a patch as issue 76 http://code.google.com/p/clojure/issues/detail?id=76
user=> (sorted-set-by #(> (:hat %1) (:hat %2)) {:hat 2} {:hat 3} {:hat
1})
#{{:hat 3} {:hat 2} {:hat 1}}
> Yes, this is just an API gap. Issue/patch welcome.
--~--~-~--~~~---~--~~
You
>> (push "/home/boris/.emacs.d" load-path)
>This is actually already on the load-path by default; no need to add it.
Standard load-path on ubuntu didn't include ~/.emacs.d for me. Not
sure why not.
load-path is a variable defined in `C source code'.
Its value is
("/etc/emacs-snapshot" "/etc/emac
Tim,
Thanks much. Very useful and surprisingly simple.
Mike
--~--~-~--~~~---~--~~
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 gro
On Feb 6, 10:36 pm, Emeka wrote:
> You could even embed a REPL into your
> application with a socket
> I am interested, could you make a rough patch for me to draw some
> inspiration from
There is a handy server_socket.clj in clojure-contrib which makes it
relatively trivial to set up:
http://
On Tue, Feb 10, 2009 at 1:57 PM, Remco van 't Veer wrote:
> On Tue, Feb 10, 2009 at 1:33 PM, Rich Hickey wrote:
>> On Feb 10, 3:47 am, "Remco van 't Veer" wrote:
>>> Hi Rich,
>>>
>>> I've been working on getting clojure in a more usable state for android
>>> [1]. One of the challenges was to s
On 10.02.2009, at 19:18, Jeffrey Straszheim wrote:
> I suggested the following changed to letfn:
>
> http://code.google.com/p/clojure-contrib/issues/detail?id=26
>
> and have been informed that you manage this code. Does this change
> look good to you?
Fine! It's applied and committed. Than
I'm trying to re-implement some python stuff in clojure. Here's how
it works: I have a class called ArrowKeySelection. I use this class
as a mixin with various gui classes. The class adds some abstract
logic for handling keys - the arrow keys move a selector around a
matrix and the enter key
I notice the front page of the wiki has had some changes awaiting
review:
http://en.wikibooks.org/wiki/Clojure_Programming
Apparently they've been waiting for almost a month now?
I also noticed this comment on the discussion page:
"The approved revision mechanism is killing this wiki. I'm avoid
Hi James,
You can acheive the same thing with type hints:
(defn abs [#^Double x] (Math/abs x))
Cheers
Tom
2009/2/11 Jason Wolfe
>
> Never mind, silly me. Of course, the identity of the method is not
> the issue, it's the type of the argument.
>
> user> (defn abs [x] (let [x (double x)]
78 matches
Mail list logo