Hello,
On Mon, Sep 14, 2009 at 11:48 PM, ajuc aju...@gmail.com wrote:
Hello, I'm new in clojure and lisp, and I have problem with making
this code elegant (or at least short).
This is Floyd-Warshall algorithm - very simple algorithm in imperative
form (3 nested for loops).
In clojure the
On Mon, Sep 14, 2009 at 10:02 PM, Tom Faulhaber tomfaulha...@gmail.com wrote:
Did you also read the overview that's part of contrib at
http://richhickey.github.com/clojure-contrib/doc/datalog.html.
So because of this thread, I just went and perused the description of
the Clojure datalog
Ha, ha, some object-oriented lessons are being rediscovered :)))
For example, you would have an opaque Person object, perhaps in a
Ref, and functions like get-name, set-name, get-policy, etc. The
underlying storage model can be whatever you want -- sets, SQL,
files, You just have to
Hi all,
I'm looking at extending a java class in clojure, however I can't find
any mention of how to access or change state within my super class
object e.g. given a java class like this:
public class Foo {
protected int foo = 10;
// ...
}
How can I write the equivalent of this in
[snip]
You are accumulating a result, which hints us at 'reduce.
And 'for provides the nested enumeration:
(defn floyd-warshall2 [{:keys [nodes distances]}]
(reduce (fn [[distances prevs] [k x y]]
(let [d (+ (distances [x k] Double/POSITIVE_INFINITY)
I thought it would be interesting to make a version which spits out
the paths:
http://github.com/timothypratley/strive/blob/master/clj/sandpit/fw.clj
shortest-path 7 2:
({:node 7, :step-cost 0, :remaining-cost 6}
{:node 8, :step-cost 1, :remaining-cost 5}
{:node 6, :step-cost 1,
On Tue, Sep 15, 2009 at 7:15 AM, Rick Moynihan rick.moyni...@gmail.com wrote:
Hi all,
I'm looking at extending a java class in clojure, however I can't find
any mention of how to access or change state within my super class
object e.g. given a java class like this:
public class Foo {
That's my plan for the next release. Unfortunately, the change to test-
is came out right before I finished the release. After reviewing what
it would take to update, I decided to wait.
If you make the changes on your fork, I'll be happy to merge them in.
-Matt
On Sep 14, 11:31 am, Stuart
Fixed in the main branch. Stu made the change on his fork, and I
merged it in.
-Matt
On Sep 14, 2:52 pm, Jim Menard jim.men...@gmail.com wrote:
Matt,
There's a missing double quote on line 11 of lancet.sh. After adding
that, I had no problem compiling Conjure. Looking forward to trying
it.
The bigger problem here is that the ant jar task loses file
permissions, so after Conjure expands the file structure to create a
project Unix users will have to chmod u+x any files that are scripts.
I looked at it for about 10 seconds and decided it wasn't easily
fixable without going
I was just wondering about the unwind-protect form, I've heard that it
doesn't protect against certain types of exits, but what exactly are
these exits? I've heard return, break, and continue statements said
but i can't seem to find these statements in clojure. Any examples?
On Sep 15, 6:54 pm, Gorsal s...@tewebs.com wrote:
I was just wondering about the unwind-protect form, I've heard that it
doesn't protect against certain types of exits, but what exactly are
these exits? I've heard return, break, and continue statements said
but i can't seem to find these
On 14 Wrz, 19:51, Michael Wood esiot...@gmail.com wrote:
(...)
What does your runclojure script look like?
Yes, that's the point. If the problem isn't in the Clojure itself, nor
in the source file, and the files are placed exactly where they should
be, the only possibility is the script used
On 14 Wrz, 20:06, Richard Newman holyg...@gmail.com wrote:
Nope, it's not that easy. I changed clojure.example.hello to
clojure.examples.hello in the hello.clj file, and the message was
still the same. (Hard to believe, isn't it?)
What's the value of *compile-path*? Is it in your
Although I still don't understand why the current working directory
can cause such problems (shouldn't Java be able to make proper use of
the classpath?), my problem has been solved.
Because the compilation of Clojure files produces files in *compile-
path* (classes by default), which is
Dear all,
I've successfully extended a Java class (:gen-class and :extends) and
all is working as expected, until I was forced to call a protected
final method of the superclass from within my derived class. I don't
seem find a way to do this (:exposes-methods really is only for
overridden
On Tue, Sep 15, 2009 at 2:08 PM, Sir Diddymus sirdidd...@googlemail.com wrote:
Dear all,
I've successfully extended a Java class (:gen-class and :extends) and
all is working as expected, until I was forced to call a protected
final method of the superclass from within my derived class. I
The API documentation:
http://clojure.org/data_structures#toc22
mentions the existence of the basic set operations of union, intersection,
and difference. But these functions don't seem to exist anymore (including
in the version of clojure I pulled from github about five minutes ago). I
was
The API documentation:
http://clojure.org/data_structures#toc22
mentions the existence of the basic set operations of union,
intersection, and difference. But these functions don't seem to
exist anymore (including in the version of clojure I pulled from
github about five minutes
Ah, I thought there was a contrib out there for unwind-protect . I
guess its so trivial that no one wrote it. lol.
On Sep 15, 12:25 pm, Joost jo...@zeekat.nl wrote:
On 15 sep, 18:19, Jarkko Oranen chous...@gmail.com wrote:
Unwind-protect? Isn't that a Common Lisp thing? Sounds like you got
On Tue, Sep 15, 2009 at 21:47, Brian Hurt bhur...@gmail.com wrote:
The API documentation:
http://clojure.org/data_structures#toc22
mentions the existence of the basic set operations of union, intersection,
and difference. But these functions don't seem to exist anymore (including
in the
I'll make a note on the wiki to chmod the scripts in Unix. I'm not
sure what else I can do. I swear I tested all of this on my Mac.
-Matt
On Sep 15, 10:17 am, Stuart Halloway stuart.hallo...@gmail.com
wrote:
The bigger problem here is that the ant jar task loses file
permissions, so after
After a discussion in dcug about the write-skew anomaly, I wanted to
write a program exhibiting the anomaly, together with a similar
program using ensure to eliminate it.
My program doesn't work: it exhibits the anomaly, but ensure doesn't
fix it, and neither does adding a validator to the refs.
On Sep 15, 9:27 am, CuppoJava patrickli_2...@hotmail.com wrote:
Yes. I haven't personally run into any problems (since I handle my own
threading), but it's explicitly stated that you shouldn't put mutable
data into Clojure's immutable data structures. It's possible that I
misunderstood what
I think the problem is that you only ensure one of the Refs. If you
want to make sure that a condition between multiple Refs isn't
violated, you need to sure all of them. Otherwise other transactions
will be free to modify the Refs that aren't ensured.
On Tue, Sep 15, 2009 at 3:14 PM, Krukow
On Tue, Sep 15, 2009 at 3:23 PM, Mark Volkmann
r.mark.volkm...@gmail.com wrote:
I think the problem is that you only ensure one of the Refs. If you
want to make sure that a condition between multiple Refs isn't
violated, you need to sure
I meant ensure instead of sure.
all of them.
I've been looking for a Clojure REPL loop in a java window, the
general idea is to use it as an ad-hoc inspector for existing java
programs. Does this already exist?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups
Hi,
I'm visiting from the Common Lisp world and I'm wondering if Clojure's
multimethods support method combination? (Please forgive me if this
has already been asked and just direct me to the relevant
documentation.)
Here's a contrived example. B derives from A and both have methods
defined for
repl.clj in the files section of the group is exactly what you want.
--~--~-~--~~~---~--~~
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
Note that posts from
I'm visiting from the Common Lisp world and I'm wondering if Clojure's
multimethods support method combination? (Please forgive me if this
has already been asked and just direct me to the relevant
documentation.)
Discussed previously:
2009/9/15 Gorsal s...@tewebs.com:
Ah, I thought there was a contrib out there for unwind-protect . I
guess its so trivial that no one wrote it. lol.
There's error-kit:
http://richhickey.github.com/clojure-contrib/error-kit-api.html
Not sure how much that is or is not like unwind-protect.
--
I ran program #1 and #2 on Clojure 1.1.0-alpha-SNAPSHOT from git
- program #1 output skew
- program #2 no output
What version are you using? Could be something that's been fixed
recently.
On Sep 16, 6:14 am, Krukow karl.kru...@gmail.com wrote:
After a discussion in dcug about the write-skew
unwind-protect is indeed a Common Lisp form, not Clojure. It ensures
that a given piece of code is always executed, even when an error or
some other condition causes the code to exit early.
In Clojure (and Java), the nearest equivalent is the try-catch-finally
block. It looks like this:
(try
On Sep 15, 6:54 am, Dragan Djuric draga...@gmail.com wrote:
Ha, ha, some object-oriented lessons are being rediscovered :)))
Precisely! Just because the language doesn't enforce information
hiding doesn't mean you can't do it.
-SS
--~--~-~--~~~---~--~~
You
Thank you all for your input. I think I will follow Stuart's advice
and go with something like the following, again using the example data
above.
(use 'clojure.set)
(def policies (ref #{{:id 3 :name x :holder 7 :vehicle 11}
{:id 4 :name y :holder 2 :vehicle
12}}))
On Sep 15, 10:23 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote:
I think the problem is that you only ensure one of the Refs. If you
want to make sure that a condition between multiple Refs isn't
violated, you need to sure all of them. Otherwise other transactions
will be free to modify
On Sep 16, 12:32 am, Timothy Pratley timothyprat...@gmail.com wrote:
I ran program #1 and #2 on Clojure 1.1.0-alpha-SNAPSHOT from git
- program #1 output skew
- program #2 no output
What version are you using? Could be something that's been fixed
recently.
I was running a fairly recent,
On Wed, Sep 16, 2009 at 6:13 AM, Krukow karl.kru...@gmail.com wrote:
On Sep 15, 10:23 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote:
I think the problem is that you only ensure one of the Refs. If you
want to make sure that a condition between multiple Refs isn't
violated, you need to
38 matches
Mail list logo