I remember from 5 years ago that a collegue of mine improved a
diffusion algorithm for a successor of me by some heavy algorithms. My
own algorithm was a simple loop-over-the- array once, dump-a-fraction-
of-each-cell-into-spatially-neighbouring-cells-in-the-new-array, and
sum what is in every cel
Thanks for reminding me about #1 ;)
On Jan 14, 11:08 pm, Rich Hickey wrote:
> On Jan 14, 2:57 pm, Rich Hickey wrote:
>
>
>
> > On Jan 13, 12:39 pm, samppi wrote:
>
> > > Recently, I asked how to make a function evaluate its arguments lazily
> > > (http://groups.google.com/group/clojure/browse_
Hi,
I am trying an example in Stuart Halloway's book but I am not getting
anywhere:
loading the following:
(ns reader.snippet-server
(:use [compojure html http jetty file-utils]
examples.snippet))
(use 'compojure.http)
(defservlet snippet-servlet
"Create and view snippets."
(GET
Oops, sorry, wrong group, I have posted to the compojure list now.
2009/1/15 Tom
>
> Hi,
>
> I am trying an example in Stuart Halloway's book but I am not getting
> anywhere:
>
> loading the following:
>
> (ns reader.snippet-server
> (:use [compojure html http jetty file-utils]
>example
Hey gang,
First time poster!
I figured the best way to explore the interesting parts of Clojure
(for me: STM, Java interop) would be to implement a simple locking
problem in Java and Clojure, and pit them against eachother. The
results are about what I expected, but I'm sure you all can tell me
Hello,
I'm new to Clojure, SLIME, and emacs in general but I've noticed my
SLIME REPL does not indent properly when I use or C-j. This
is the error message I see:
"calculate-lisp-indent: Symbol's function definition is void: clojure-
indent-function"
I've experienced this when setting up Cloju
On Jan 15, 2009, at 2:57 AM, bOR_ wrote:
That is, if I understand blocking correctly. Currently assuming that
blocking only happens when two things would like to write the same
ref?
Blocking in this case refers to this definition:
http://en.wikipedia.org/wiki/Blocking_(computing)
You should
Do *1 *2 *3 ... are saved in a built in sequence that we can inspect
its contents?
On Jan 14, 2:20 pm, Martin Wood-Mitrovski wrote:
> On Wed, 14 Jan 2009 04:15:18 -0800 (PST)
>
> HB wrote:
>
> > Lets say that the result of each method invocation will be saved in a
> > stack.
> > The stack now c
stuhood a écrit :
> Hey gang,
>
> First time poster!
>
> I figured the best way to explore the interesting parts of Clojure
> (for me: STM, Java interop) would be to implement a simple locking
> problem in Java and Clojure, and pit them against eachother. The
> results are about what I expected, b
On Jan 15, 2009, at 7:28 AM, HB wrote:
Do *1 *2 *3 ... are saved in a built in sequence that we can inspect
its contents?
No, they are separate vars. Here's the code from the core of the read-
eval-print loop in clojure/src/clj/clojure/main.clj that shows how
they're updated:
>>As a group, *1, *2, and *3 form (effectively) a small queue (not a stack as
>>someone mentioned previously).
It was me :)
On Jan 15, 3:00 pm, "Stephen C. Gilardi" wrote:
> On Jan 15, 2009, at 7:28 AM, HB wrote:
>
> > Do *1 *2 *3 ... are saved in a built in sequence that we can inspect
> >
What would be a good way to implement quicksort in clojure (or any
persistent language)? I mean, not just something that works or has
the right theoretical runtime. I've thought about just looking to
see how sort was implemented in clojure, but I don't know if it would
get to my point once I fo
I've checked in a bash script for launching Clojure to clojure-contrib/
launchers/bash/clj-env-dir.
It's configured using environment variables (one required and several
optional). It sets up the CLASSPATH for the Clojure instance it
launches based on the contents of a directory. This is a m
I think I know when to use one and when to use the other, but the
extra clarification doesn't hurt. However, what happens if you get it
wrong? use send where you should have used send-off, and visa versa? I
would like to know what they do differently.
On 15 jan, 13:12, "Stephen C. Gilardi" wrote
came across over the net the following examples.
I can understand full destructuring because "[" and "]"
mirrors the structure of tree.
But in partial desctructuring, [[a [b]] has extra pair of outer-most
[] which leads to confusion. Any explanation on that?
Also not sure about the last (on string
On Jan 15, 2009, at 9:26 AM, bOR_ wrote:
I think I know when to use one and when to use the other, but the
extra clarification doesn't hurt. However, what happens if you get it
wrong? use send where you should have used send-off, and visa versa? I
would like to know what they do differently.
By default Return is bound to the command newline which does not
indent. If you press the Tab key, you'll be placed at the correct
indentation spot. To make this automatic, you need to rebind Return
to newline-and-indent:
(global-set-key (kbd "C-m") 'newline-and-indent)
Hope this helps.
Vince
On Tue, Dec 30, 2008 at 1:24 PM, CuppoJava wrote:
>
> Haha yeah... it's a rather poor API.
>
> I'm making do with a temporary post-constructor hook that I manually
> call after instantiating the object right now. But it's tedious and
> error-prone.
I've posted a feature request:
http://code.goog
On Mon, Jan 12, 2009 at 10:58 PM, aria42 wrote:
>
> Couldn't it have access to the other bindings so far like let? And
> then just have the order of options reflect the partial order induced
> by dependency? So is this possible...
>
> (with-command-line *command-line-args*
> "my-program"
> [[si
Hi Kyle,
On Wed, Jan 14, 2009 at 11:27 PM, Kyle Smith wrote:
> I'm new to Clojure, SLIME, and emacs in general but I've noticed my
> SLIME REPL does not indent properly when I use or C-j. This
> is the error message I see:
>
> "calculate-lisp-indent: Symbol's function definition is void: clojur
On Jan 15, 2009, at 10:51 AM, Chouser wrote:
>
> On Mon, Jan 12, 2009 at 10:58 PM, aria42 wrote:
>>
>> Couldn't it have access to the other bindings so far like let? And
>> then just have the order of options reflect the partial order induced
>> by dependency? So is this possible...
>>
>> (with
On Thu, Jan 15, 2009 at 8:58 AM, Stephen C. Gilardi wrote:
> I've checked in a bash script for launching Clojure to
> clojure-contrib/launchers/bash/clj-env-dir.
I had a launch script (which I've now lost due to my own clumsiness)
that defaulted to a repl if given no file options, and always loa
On Thu, Jan 15, 2009 at 11:10 AM, Matt Revelle wrote:
>
> Perhaps for built-in types, the command-line spec should support
> defining the destination type and handle the conversion from string.
That's an interesting idea. It would allow the automatic help text to
be more specific as well.
--Ch
Hi Allen,
Good idea. But instead of setting *e I've modified "report" to print
a brief stack trace for every error. See if that works.
-Stuart Sierra
On Jan 14, 11:30 pm, Allen Rohner wrote:
> Here's a trivial patch that I've found useful. After catching an
> uncaught exception in a test, se
On Jan 15, 2009, at 17:31, Chouser wrote:
> I had a launch script (which I've now lost due to my own clumsiness)
> that defaulted to a repl if given no file options, and always loaded a
> .clojurerc.clj file before starting a repl (whether it was by default
> or specifically asked via -r). This
I think a script like this should be included with the Clojure
download. It's seems to me that everyone needs one and currently has
to write their own by copying example script code from the Getting
Started page. Maybe we can't reach a concensus on everything the
script should do, but providing a
On Thu, Jan 15, 2009 at 11:45 AM, Konrad Hinsen
wrote:
>
> If I understand correctly what you are looking for, it exists. Here
> is my standard command line for starting Clojure:
>
> java -cp $HOME/.clojure/clojure.jar:$HOME/.clojure/clojure-
> contrib.jar clojure.main -i $HOME/.clojure/repl-ini
On Jan 15, 2009, at 11:31 AM, Chouser wrote:
I had a launch script (which I've now lost due to my own clumsiness)
that defaulted to a repl if given no file options, and always loaded a
.clojurerc.clj file before starting a repl (whether it was by default
or specifically asked via -r). This all
I found my problem. There were some issues with the underlying Subversion
actions happening at the same time. I wasn't catching those errors though
because I wasn't looking at agent-errors.
I have it working correctly now with an agent per project (since a series of
updates for the project is th
On Jan 15, 1:37 pm, e wrote:
> What would be a good way to implement quicksort in clojure (or any
> persistent language)?
Lennart Augustsson's point is that destructive updates are part of the
Quicksort algorithm. If we accept that, then you'd want to use a plain
old java array in your algorithm
"Mark Volkmann" writes:
> I think a script like this should be included with the Clojure
> download. It's seems to me that everyone needs one and currently has
> to write their own by copying example script code from the Getting
> Started page.
Strongly agree. If 1.0 is released without this it
On Jan 15, 2009, at 1:53 PM, Daniel Jomphe wrote:
What would you consider the normal way of solving this small problem
of mine?
(reduce #(and %1 %2) [true false true])
--Steve
smime.p7s
Description: S/MIME cryptographic signature
Er, oops, forgot you can't HTML here.
Anyway, the upshot is that now
user=> (import '(java.util ArrayList))
nil
(doseq [s ['(1 2) (seq '(1 2)) [1 2] (seq [1 2]) (ArrayList. [1
2])]]
(print "\n" (.hashCode s))
(doseq [t ['(1 2) (seq '(1 2)) [1 2] (seq [1 2]) (ArrayList. [1
2])]]
(print "\
Thanks Bill. That's just what I needed.
On Jan 15, 7:58 am, Bill Clementson wrote:
> Hi Kyle,
>
>
>
> On Wed, Jan 14, 2009 at 11:27 PM, Kyle Smith wrote:
> > I'm new to Clojure, SLIME, and emacs in general but I've noticed my
> > SLIME REPL does not indent properly when I use or C-j. This
> >
Daniel Jomphe a écrit :
> I'm in the following situation:
>
>(and '(true true))
>;doesn't work
>
>
(every? identity [true false true])
Christophe
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure"
I'm in the following situation:
(and '(true true))
;doesn't work
I tried apply, reduce, and a few other things. Reading the apidocs,
reduce is said to be the proper choice to compute a boolean from a
seq. But:
(reduce and '(true true))
;Exception: Can't take value of a macro: #'cloj
Look at every?. The predicate true? returns true if its argument is
the boolean literal true, and false otherwise. If, instead, you want
to check for logical truth (false and nil are false, everything else
is true), then use identity. As you can see, every? falls out at the
first false result.
us
> (every? identity [true false true])
So obvious, yet so overlooked each time I read the function names in
the api!
Thanks to both you! Looks like I'll be having a bunch of fun through
this learning curve in the future. :)
--~--~-~--~~~---~--~~
You received this m
I just encountered a surprise attempting to return a function from a
function. In the below case, if the function parameter is named "fn",
then calling the function throws an exception. If the function
parameter is named "f", no problem. (Using svn as of yesterday)
(defn no-problem[f]
(fn [] (a
On Jan 15, 2:54 pm, wubbie wrote:
> But in partial desctructuring, [[a [b]] has extra pair of outer-most
> [] which leads to confusion. Any explanation on that?
Extra pair of []? What do you mean?
The destructuring pattern is: [[a [b]] & leftover]
The pattern you're matching is: (("one" ("two")
> Extra pair of []? What do you mean?
Sorry, my bad.
-sun
On Jan 15, 1:25 pm, James Reeves wrote:
> On Jan 15, 2:54 pm, wubbie wrote:
>
> > But in partial desctructuring, [[a [b]] has extra pair of outer-most
> > [] which leads to confusion. Any explanation on that?
>
> Extra pair of []? What
Update: Rich just fixed this in http://code.google.com/p/
clojure/issues/detail?id=37&colspec=ID%20Type%20Status%20Priority
%20Reporter%20Owner%20Summary">svn 1215 .
-Jason
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Gro
Even if this gets fixed, I don't think it's a good idea to give
parameters the same name as a widely used function. It's bound to
confuse someone.
On Thu, Jan 15, 2009 at 1:12 PM, Hugh Winkler wrote:
>
> I just encountered a surprise attempting to return a function from a
> function. In the belo
but loop/recur for the partition could try to reuse as much of an existing
structure as possible and then be quite nice as things get gc'd early on.
Mergesort uses a lot of temporary space as things move along. Yes I like
mergesort. folks already helped me get that one going.
On Thu, Jan 15, 200
When you're using fn as a parameter name, you are shadowing the fn
special form. Like Mark Volkmann said, it is best that you refrain
from using special form names and core macros and functions names to
name your own things. f is the prefered notation to name a function
passed to another functio
by having a parameter named "fn" you are shadowing the global "fn"
so what is happening is the "(fn ...)" form inside the function is
trying to apply the function you passed in to the arguments. the
function
you passed in takes no arguments so you get the " Wrong number of args
passed to"
exceptio
On Jan 15, 12:09 am, bOR_ wrote:
> I remember from 5 years ago that a collegue of mine improved a
> diffusion algorithm for a successor of me by some heavy algorithms. My
> own algorithm was a simple loop-over-the- array once, dump-a-fraction-
> of-each-cell-into-spatially-neighbouring-cells-in-t
Welcome to the group! :-)
On Jan 15, 1:38 am, stuhood wrote:
> The benchmark contains 4 bi-directional dictionary implementations:
> * MDict - Java implementation using the synchronized keyword,
> * RWDict - Java implementation using a ReadWriteLock,
> * CLJDict - Clojure implementation using
On Thu, Jan 15, 2009 at 8:35 PM, Mark H. wrote:
>
> Welcome to the group! :-)
>
> On Jan 15, 1:38 am, stuhood wrote:
>> The benchmark contains 4 bi-directional dictionary implementations:
>> * MDict - Java implementation using the synchronized keyword,
>> * RWDict - Java implementation using a
On Thu, Jan 15, 2009 at 8:47 PM, Christian Vest Hansen
wrote:
> On Thu, Jan 15, 2009 at 8:35 PM, Mark H. wrote:
>> On Jan 15, 1:38 am, stuhood wrote:
>>> The benchmark contains 4 bi-directional dictionary implementations:
...
>>
>> Doesn't Java already have a more optimized thread-safe hash tab
OK, thanks all, got it.
Hugh
On Thu, Jan 15, 2009 at 1:33 PM, redc...@gmail.com wrote:
>
> by having a parameter named "fn" you are shadowing the global "fn"
> so what is happening is the "(fn ...)" form inside the function is
> trying to apply the function you passed in to the arguments. the
Sort of got distracted and stopped paying attention to getting that to
run. I'll report when I get to it and learn more :).
On Jan 5, 11:43 pm, "Shawn Hoover" wrote:
> On Mon, Jan 5, 2009 at 4:24 PM, bOR_ wrote:
>
> > Just downloaded clojurebox and it installs like a charm here (windows
> > vis
On Jan 15, 2:05 pm, Daniel Jomphe wrote:
> > (every? identity [true false true])
>
> So obvious, yet so overlooked each time I read the function names in
> the api!
Hi Daniel,
FYI, the reason "and" doesn't work is that it's a macro, not a
function. Only functions can be used with "apply".
If
Stuart Sierra wrote:
> FYI, the reason "and" doesn't work is that it's a macro, not a
> function. Only functions can be used with "apply".
When I found that out, I was surprised. My knowledge of lisp comes
from reading, in the past few months:
- ANSI Common Lisp
- Practical Common Lisp
and, som
On Jan 14, 6:01 pm, Jason Wolfe wrote:
> I've already posted here [1] and on the issue board [2] about
> hashing. In particular, .hashCode for seqs/colls break the Java
> contract that whenever (.equals x y), (= (.hashCode x) (.hashCode
> y)). (let x = [1] and y = (seq [1])). As I've mentioned
> > Instead the first three might suggest corollaries:
> > map-when map-when-not map-while
>
> Perfect.
>
On second thought, do you think map-when-not would actually be
useful? Unless you're interested in the difference between nil and
false, I think it's equivalent to (replicate (count (remove
I am trying to build Clojure on Fedora 10. When I first run ant, I get
a message about the compliance level 1.4 not supporting target version
1.5. So I add source="1.5" to the javac task. Then I get a lot of
warnings and the following 3 errors.
[javac] 354. ERROR in /home/rdp/lisp/clj/cloju
The improved error reposting in test-is breaks some tests, e.g. from
the book:
(deftest test-lazy-index-of-any-with-match
(is (with-out-str (is (zero? (index-of-any "zzabyycdxx" #{\z \a}
"Iterating overz\n")
(is (with-out-str (is (= 3 (index-of-any "zzabyycdxx" #{\b \y}
> >unquotewould not be defined by Clojure, so still an error if allowed
> > to get evaluated.
>
> > Things like your sql would be macros that handled (unquotex)
> > internally.
>
> SVN 1184 implements this.
>
> Feedback welcome on its utility for macro writers.
>
> Rich
I like this a lot. Any c
Hi
Came across Chouser's posting below:
I know *agent* is for global designation.
My question is how the first agent (agent nil) and *agent* used
later in another nested send-off related?
Also m after (fn is a function name so that it can be referred to
later inside the same function?
Thanks
sun
Hi!
I've had no experience in Lisp or clojure before. I've only worked
with Java and Ruby, so this question may seem stupid. Is there any way
to run a clojure app without REPL?
For example something like: clojure my_app.clj
I've read that you can compile clojure with the comile function, but
thi
>
>
> Hi!
> I've had no experience in Lisp or clojure before. I've only worked
> with Java and Ruby, so this question may seem stupid. Is there any way
> to run a clojure app without REPL?
>
> For example something like: clojure my_app.clj
>
Something like this:
java-cpclojure.jar:my_app_
anyone able to get this going on a Mac yet? The main window comes up, but
shortly after crashes.
On Mon, Jan 12, 2009 at 5:24 PM, BerlinBrown wrote:
>
> Here is an example SWT application. It is a 'search' tool. Open a
> file and the search term is highlighted. It has a java oriented
> appro
It's probably this:
http://www.eclipse.org/swt/faq.php#carbonapp
On Thu, Jan 15, 2009 at 9:20 PM, e wrote:
> anyone able to get this going on a Mac yet? The main window comes up, but
> shortly after crashes.
>
>
> On Mon, Jan 12, 2009 at 5:24 PM, BerlinBrown wrote:
>
>>
>> Here is an example SW
On Jan 14, 1:03 pm, Jason Wolfe wrote:
> > > (import '(java.util HashSet))
> > > (defn distinct-elts? "Are all of the elements of this sequence
> > > distinct? Works on infinite sequences with repititions, making it
> > > useful for, e.g., detecting cycles in graphs."
> > > [s]
> > > (let [hs
> Ah! but a mere hash table is not bi-directional :-)
Right =) I got the idea in a Channel 9 video about MS' efforts with STM:
http://channel9.msdn.com/shows/Going+Deep/Software-Transactional-Memory-The-Current-State-of-the-Art/(which
reminds me, the spin-lock approach they try is probably fairly
There is a standalone compiler that runs without the REPL:
clojure.lang.Compile. The best examples of using it are the Ant
build.xml files for Clojure and clojure-contrib.
If I have time tomorrow I'll try to post a more detailed how-to.
-Stuart Sierra
On Jan 15, 6:53 pm, linh wrote:
> Hi!
>
On Jan 15, 6:04 pm, Daniel Jomphe wrote:
> And still, I wasn't prepared for the fact that macros don't mix 100%
> with functions. Either I overlooked an important section in these
> books, or they didn't really cover it much.
It's not covered much. You get used to it. Think of it this way --
m
I was afraid that would happen. I'll fix it, probably tomorrow.
-the other Stuart
On Jan 15, 6:27 pm, Stuart Halloway wrote:
> The improved error reposting in test-is breaks some tests, e.g. from
> the book:
>
> (deftest test-lazy-index-of-any-with-match
> (is (with-out-str (is (zero? (inde
You do that.
-another Stuart
On Thu, Jan 15, 2009 at 10:32 PM, Stuart Sierra wrote:
>
> I was afraid that would happen. I'll fix it, probably tomorrow.
> -the other Stuart
>
> On Jan 15, 6:27 pm, Stuart Halloway wrote:
> > The improved error reposting in test-is breaks some tests, e.g. from
>
yeah. That fixed it. Thanks.
On Thu, Jan 15, 2009 at 9:53 PM, Paul Barry wrote:
> It's probably this:
> http://www.eclipse.org/swt/faq.php#carbonapp
>
>
> On Thu, Jan 15, 2009 at 9:20 PM, e wrote:
>
>> anyone able to get this going on a Mac yet? The main window comes up, but
>> shortly after
I was doing some microbenchmarking earlier, and I noticed some very
very weird anomalies. If anyone could shed some light on what's
going on that would be awesome. (I'm using the latest SVN, and have
verified this on a totally clean repl).
Simplified as much as possible, the heart of what I obs
> fuzzy in my mind how some functions interact well with macros while
> some others don't.
Good:
(some-function (some-macro stuff))
Bad:
(some-function some-macro stuff)
For me I find it easiest to remember as "macros are not first class
functions" ie: they cannot be passed to and executed by o
On 16.01.2009, at 00:04, Daniel Jomphe wrote:
> When I found that out, I was surprised. My knowledge of lisp comes
> from reading, in the past few months:
> - ANSI Common Lisp
> - Practical Common Lisp
> and, some years ago, a few more things.
The best book to read about macros is in my opinion
74 matches
Mail list logo