On 20.12.2008, at 22:50, jim wrote:
> I also think this would be a great addition to clojure-contrib.
Me too. But who decides what goes into clojure-contrib? Rich?
> Because of the way most monad tutorials are written, monads seem to be
> pretty hard to get your head around. Also, many of the
Good Evening Clojurians,
I have been working on a Clojure implementation of the format function
from Common Lisp and it's coming along well enough that I thought I'd
share.
You can see/download the current state of it in its github project:
http://github.com/tomfaulhaber/cl-format/
It's current
I misspoke; it's the call to counter that's the problem. Let's say
you want to use a counter to count the number of times a ref is set,
something like this:
(dosync (counter) (ref-set r 1))
If your var-set causes the transaction to retry, an atom-based counter
will increment twice. As I unders
On Dec 22, 5:45 am, "Mark Engelberg" wrote:
> But if mk-counter is called twice because it's retried in part of a
> transaction, then you're in big trouble when you use atom. Better to
> use a ref here. atom needs to be reserved for the very few cases when
> retries don't matter (like a cache
On Dec 22, 5:24 am, "Brian Doyle" wrote:
> I haven't been following the new atom stuff, so I was wondering why atom
> would be best in this
> situation, vs a ref? Thanks.
Rich discusses the use of atoms, refs and agents in good detail
in this thread:
http://groups.google.com/group/clojure/msg
On Dec 21, 2008, at 7:24 PM, Brian Doyle wrote:
I haven't been following the new atom stuff, so I was wondering why
atom would be best in this
situation, vs a ref? Thanks.
The implementation of atoms is supported by the JVM typically using a
processor hardware instruction that accomplis
But if mk-counter is called twice because it's retried in part of a
transaction, then you're in big trouble when you use atom. Better to
use a ref here. atom needs to be reserved for the very few cases when
retries don't matter (like a cache).
--~--~-~--~~~---~--~---
I haven't been following the new atom stuff, so I was wondering why atom
would be best in this
situation, vs a ref? Thanks.
On Sun, Dec 21, 2008 at 1:03 PM, Parth Malwankar
wrote:
>
>
>
> On Dec 21, 11:47 pm, chris wrote:
> > I would like to be able to encapsulate local state in a closure.
> >
On Dec 21, 2008, at 6:44 PM, Jason wrote:
Why doesn't (count (doall (range 100))) cause an out-of memory
error? doall says it causes the entire seq to reside in memory at one
time, yet:
(range n) produces an object that is a seq, not just one that's seq-
able. Its "rest" operation i
Yet another question, this time just a curiosity. Sorry for the
plethora of posts, but I'm trying to make sure I understand lazy seqs
properly.
Why doesn't (count (doall (range 100))) cause an out-of memory
error? doall says it causes the entire seq to reside in memory at one
time, yet:
On Sunday 21 December 2008 15:14, ntu...@googlemail.com wrote:
> Why do "bit-or" and "bit-and" only accept 2 arguments? "or" and "and"
> accept an arbitrary number and I think it is useful to modifiy "bit-
> or" and "bit-and" to accept 2 or more, for example:
>
> (defn my-bit-or [x y & rest]
> (
On Sun, Dec 21, 2008 at 7:03 PM, Adam Harrison (Clojure)
wrote:
[...]
> (defmacro where [& triples]
> `(let [encode# (fn [x#] (cond (and (symbol? x#) (= (first (name x#))
> \?)) (name x#)
> (integer? x#) (str "\"" x# "\"^^xsd:integer")
> (
Why do "bit-or" and "bit-and" only accept 2 arguments? "or" and "and"
accept an arbitrary number and I think it is useful to modifiy "bit-
or" and "bit-and" to accept 2 or more, for example:
(defn my-bit-or [x y & rest]
(reduce #(clojure.lang.Numbers/or %1 %2) (list* x y rest)))
What does the
Adam, I just joined the list, but I am very interested in working with
you on the SPARQL DSL. Let me catch up on what you've written and
we'll muddle through it together.
Glad to see there are other Clojure-loving SemWeb nerds around here. :)
--~--~-~--~~~---~--~-
On Dec 21, 2008, at 4:43 PM, Stephen C. Gilardi wrote:
On Dec 21, 2008, at 4:40 PM, Rich Hickey wrote:
If main doesn't match the behavior of Repl and Script in this area
when run in repl or script modes respectively, it needs to. Repl
calls exit, Script does not.
OK, I'll fix that.
This is
Also, on a related note, lazy-cat always evaluates its first argument:
user> (do (lazy-cat (do (prn "1") (list 1)) nil) nil)
"1"
nil
user> (do (lazy-cons (do (prn "1") (list 1)) nil) nil)
nil
which is confusing given its documentation:
user> (doc lazy-cat)
-
clojure.core
On Sunday 21 December 2008 13:35, Mark Volkmann wrote:
> Why do I get an IncompatibleClassChangeError below? I'm using
> revision 1180.
>
> (def my-map {:a 1 :b 2})
> (namespace my-map)
> java.lang.IncompatibleClassChangeError (NO_SOURCE_FILE:0)
I'm not sure about that specific error, though I'v
On Dec 21, 2008, at 4:35 PM, Mark Volkmann wrote:
Why do I get an IncompatibleClassChangeError below? I'm using
revision 1180.
(def my-map {:a 1 :b 2})
(namespace my-map)
java.lang.IncompatibleClassChangeError (NO_SOURCE_FILE:0)
I got a more informative message, with the difference perhap
Why do I get an IncompatibleClassChangeError below? I'm using revision 1180.
(def my-map {:a 1 :b 2})
(namespace my-map)
java.lang.IncompatibleClassChangeError (NO_SOURCE_FILE:0)
--
R. Mark Volkmann
Object Computing, Inc.
--~--~-~--~~~---~--~~
You received this
On Dec 21, 2008, at 4:40 PM, Rich Hickey wrote:
If main doesn't match the behavior of Repl and Script in this area
when run in repl or script modes respectively, it needs to. Repl
calls exit, Script does not.
OK, I'll fix that.
--Steve
smime.p7s
Description: S/MIME cryptographic signatur
If main doesn't match the behavior of Repl and Script in this area
when run in repl or script modes respectively, it needs to. Repl
calls exit, Script does not.
Rich
On Dec 21, 2008, at 4:30 PM, Stephen C. Gilardi wrote:
> Based on the bottom of the ruby code example on this page:
>
> http
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 12/21/2008 12:03 PM, Adam Harrison (Clojure) wrote:
>
> Hi folks,
>
> First let me say 'Thankyou very much' for Clojure - it has enabled me to
> finally take the plunge into learning a Lisp without feeling like I'm
> abandoning a ten year inves
Based on the bottom of the ruby code example on this page:
http://rjack.rubyforge.org/jetty/classes/Jetty/ServerFactory.html
A first guess is that this would work:
(.start server)
(.join server)
Join will wait for the thread to exit before continuing. That code
makes sense if
I have another quick observation:
The (System/exit 0) bit at the end of the main function changes the
behavior of some scripts I have for starting Jetty servers. The
scripts basically end with (.start server), were server is a Jetty
Server instance, and previously would run until control-C'd from
Steve,
Your version of repl_ln.clj works for me:
1:1 user=> (+ 1 2)
3
1:2 user=> (throw (Exception. "test"))
java.lang.Exception: test (repl-1:2)
Thanks again,
- Mark
On Sun, Dec 21, 2008 at 3:47 PM, Stephen C. Gilardi wrote:
> Hi Mark,
>
> Thanks for your work on polishing up Clojure's entry
Hi Mark,Thanks for your work on polishing up Clojure's entry point situation.You're welcome. Thanks very much for the feedback.I've applied your patch and tried a series of typical entry pointscenarios; all but one of them worked for me. Just for the record,here is what did work:- Using "-h" to get
Hi Bill,
I think "compile" calls "load-lib", or something like that, so it
assumes there's a source file somewhere.
-Stuart Sierra
On Dec 21, 3:19 pm, ".Bill Smith" wrote:
> Is this a valid thing to do from the REPL?
>
> $ java -jar clojure.jar
> Clojure
> user=> (ns clojure.examples.hello
>
Whoops, looks like contrib.enum doesn't work with the new AOT-
compilation. I wrote it, so I'll take a look, but for the mean
time... don't use it. :)
-Stuart Sierra
On Dec 21, 12:56 am, Andrew Baine wrote:
> Any help is much appreciated:
>
> user> (require :verbose 'clojure.contrib.enum)
> (
Hi,
I noticed that while map produces a fully lazy result, mapcat always
evaluates the first three terms when it is called, and is lazy
thereafter. This can be confusing, and is sometimes not desired
behavior. For example, I'm trying to generate a lazy infinite seq
corresponding to a tree trave
Hi Steve,
Thanks for your work on polishing up Clojure's entry point situation.
I've applied your patch and tried a series of typical entry point
scenarios; all but one of them worked for me. Just for the record,
here is what did work:
- Using "-h" to get help
- Using no options to boot into a r
On Sunday 21 December 2008 11:33, chris wrote:
> ...
>
> That answers my question. Don't use a namespace, and the keyword is
> global. Pass in a namespace, and the keyword is in that namespace.
Yes, the default namespace for keywords is different than for symbols,
which is why the ::keyword fo
Is this a valid thing to do from the REPL?
$ java -jar clojure.jar
Clojure
user=> (ns clojure.examples.hello
(:gen-class))
(defn -main
[greetee]
(println (str "Hello " greetee "!")))
nil
clojure.examples.hello=> #'clojure.examples.hello/-main
clojure.examples.hello=> (compile 'clojure.e
On Dec 21, 8:21 pm, Emeka wrote:
> > java -cp clojure.jar clojure.lang.Script yourapp.clj
>
> In my SciTe I added java -cp clojure.jar clojure.lang.Script $(FilePath)
> plus others and when I click 'GO' or F5 instead of running the code and
> printing result. I have
>
>
>
> > java -cp clojure.
On Dec 21, 11:47 pm, chris wrote:
> I would like to be able to encapsulate local state in a closure.
> Specifically, I would like a function that returns an incrementing
> integer, thus:
> (test_func)
> 1
> (test_func)
> 2
> What is the best way to go about this? With local bindings is failing
The enclosed updated patch: unified-main-2.patch addresses all defects
I am aware of in its predecessor.
On Dec 17, 2008, at 6:10 PM, Stephen C. Gilardi wrote:
On Dec 17, 2008, at 2:27 PM, Rich Hickey wrote:
In what way is that the right thing to do?
The idea was that the sequence of top
user> (namespace :test)
nil
So it doesn't live in a namespace. But it is a distinct entity; a
comparable value.
user> (= :test :test)
true
user> (= :test :bar)
false
user> (keyword "test")
:test
user> (namespace (keyword "test"))
nil
user> (namespace (keyword "test" "user"))
"test"
user> (name
On Sunday 21 December 2008 10:18, chris wrote:
> Right, waking up a bit.
>
> I would like, at some point, to serialize a bunch of structures to a
> byte stream.
>
> They are the mapped structs (struct :data1 :data2).
>
> Lets say I would like to do this generically, I need a function that
> takes
> I am now spoiled forever, and although my powers are weak, I realise I
> have become one of those smug Lisp types condemned to look down on all
> other programming languages for the rest of their lives.
Beware, Grasshopper. The world is more complicated than you know.
--~--~-~--~~-
I would like to be able to encapsulate local state in a closure.
Specifically, I would like a function that returns an incrementing
integer, thus:
(test_func)
1
(test_func)
2
What is the best way to go about this? With local bindings is failing
and I can't figure just why...
(def test_closure
Right, waking up a bit.
I would like, at some point, to serialize a bunch of structures to a
byte stream.
They are the mapped structs (struct :data1 :data2).
Lets say I would like to do this generically, I need a function that
takes a keyword and returns an integer.
I will write out a mapping f
Hi folks,
First let me say 'Thankyou very much' for Clojure - it has enabled me to
finally take the plunge into learning a Lisp without feeling like I'm
abandoning a ten year investment in the Java platform and its libraries.
I bought 'Practical Common Lisp' about eighteen months ago and read
On Sunday 21 December 2008 09:33, chris wrote:
> This is not what I would expect:
>
> user> (== :test :test)
> false
user=> (doc ==)
-
clojure.core/==
([x] [x y] [x y & more])
Returns non-nil if nums all have the same value, otherwise false
To be clear: == is for numer
Ah,
user> (= :float :float)
true
Chris
On Dec 21, 10:33 am, chris wrote:
> This is not what I would expect:
>
> user> (== :test :test)
> false
>
> I am trying to use keywords as enumerations to texture types. I want
> to know if two textures are comparable, thus I would expect
> (== :rgba :rgb
This is not what I would expect:
user> (== :test :test)
false
I am trying to use keywords as enumerations to texture types. I want
to know if two textures are comparable, thus I would expect
(== :rgba :rgba) to return true.
I may have missed something, but it seems like Rich did away with the
> Also, is there a Clojure function that outputs all the classes and
> interfaces in the inheritance hierarchy of a given class or interface?
>
Isn't that "ancestors"?
user=> (ancestors String)
#{java.lang.Object java.lang.CharSequence java.io.Serializable
java.lang.Comparable}
--
Alber
Hi Mark,
Am 21.12.2008 um 16:51 schrieb Mark Volkmann:
Until this morning I was under the impression that ALL Clojure
collections are sequences. Now I understand (from the screencast
"Clojure Data Structures - Part 2") that vectors and maps are not and
that you need to call "seq" on them to get
On Sunday 21 December 2008 07:51, Mark Volkmann wrote:
> Until this morning I was under the impression that ALL Clojure
> collections are sequences.
Sequences are views of collections (sequential ones, if you can believe
it!). All collections can be sequenced, but they are not to be equated.
>
On Sunday 21 December 2008 07:44, Mark Volkmann wrote:
> Somebody created a class diagram for the Java classes and interfaces
> in the Clojure implementation, I believe using GraphViz, and I'm
> having trouble finding it now. Can someone share the URL?
>
> Also, is there a Clojure function that ou
It was made by Chouser:
http://groups.google.com/group/clojure/browse_thread/thread/c7ae505290cdf59a/742f3b5f740e4592
Lauri
On Sun, Dec 21, 2008 at 5:44 PM, Mark Volkmann
wrote:
>
> Somebody created a class diagram for the Java classes and interfaces
> in the Clojure implementation, I believe
Until this morning I was under the impression that ALL Clojure
collections are sequences. Now I understand (from the screencast
"Clojure Data Structures - Part 2") that vectors and maps are not and
that you need to call "seq" on them to get a sequence representation.
What are some situations where
Somebody created a class diagram for the Java classes and interfaces
in the Clojure implementation, I believe using GraphViz, and I'm
having trouble finding it now. Can someone share the URL?
Also, is there a Clojure function that outputs all the classes and
interfaces in the inheritance hierarch
>
>
> java -cp clojure.jar clojure.lang.Script yourapp.clj
>
In my SciTe I added java -cp clojure.jar clojure.lang.Script $(FilePath)
plus others and when I click 'GO' or F5 instead of running the code and
printing result. I have
>
> java -cp clojure.jar clojure.lang.Script C:\janus\myapp.clj
On Dec 19, 2:05 pm, Stuart Halloway wrote:
> According to Paul Graham's On Lisp, macroexpanders should be purely
> functional, and you should not count on how often a macro gets
> expanded. This seems like a reasonable restriction for Clojure too.
> However, Chouser posted an example that shows
On Dec 19, 3:45 pm, Stuart Sierra wrote:
> Hi Rich & all,
> While compiling Clojure, It seems that *compile-path* is being set to
> the absolute path to "classes" within the Clojure source
> distribution. That is:
>
> unzip clojure_20081217.zip
> cd clojure
> java -jar clojure.jar
> Clojure
>
On Dec 20, 5:07 pm, janus wrote:
> I wanted to use clojure.lang.Script in order to use SciTe editor,
> however, I am not getting any result. Has anyone used Script before,
> if yes, please I need your help. First ,I need direction on how to use
> it .Or anyone really used Scite with Clojure, if
> You propose a clever trick, but unfortunately it would require even
> more cleverness. What if foo, bar, and baz live in different
> libraries, and you reload one of the libraries as part of a dynamic
> update at runtime? How would the inline copies know they needed to
> update?
Annotat
56 matches
Mail list logo