aria42 a écrit :
I decided to code Tarjan's Algorithm for finding all the
strongly connected components of a graph (http://en.wikipedia.org/wiki/
Tarjan's_strongly_connected_components_algorithm). I've written this
code in Java and it's about a 100 lines. Sadly, my clojure version is
about a
I attached the source code since indentation disappear when I paste code
in mails.
Christophe Grand a écrit :
aria42 a écrit :
I decided to code Tarjan's Algorithm for finding all the
strongly connected components of a graph (http://en.wikipedia.org/wiki/
Can I see you code?
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 email to
what-a-guy a écrit :
(defmacro dlg [dlgid# fields#]
`(fn [parent# layout#]
~@(map
(fn [[f# id# text# type#]]
`(fld parent# layout# '~id# ~text# ~type#))
fields#)))
(def inp '(dlg test
(field fld-1 Field number one (JTextField.))
Thank you for all improvements and suggestions. Based on your
feedback, here is my final version:
(defn read-words
Given a file, return a seq of every word in the file, normalizing
words by
coverting them to lower case and splitting on whitespace
[in-filepath]
(re-seq #\w+
And the nice pastie version: http://pastie.org/347369
regards,
Piotrek
--~--~-~--~~~---~--~~
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
tristan a écrit :
Hi All,
I've been trying to learn clojure lately by solving the project euler
problems with it, and I think the distinct function is broken (or it
doesn't quite work as I assume it would).
here is the code i'm running
(defn pow [nbr pwr]
(if ( pwr 2)
nbr
janus a écrit :
(take 100 (for [x (range 1000) y (range 1000) ( x y)][x y]))
The above works, but when I changed [ x y] to (x y) it fails. Could
anyone come to my help.
(take 100 (for [x (range 1000) y (range 1000) ( x y)] (list x y)))
(x y) means call the function x passing y as its
Merci!
Janus
--~--~-~--~~~---~--~~
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 email to
Hi Justin,
This is the right place. Thanks for trying the plugin.
It would absolutely be helpful to document use of the plugin. However, I am
sure you can tell that it is nowhere near ready.
I would like to get a basic set of features going and then recruit you and
Randall to test and document
Hi,
Am 26.12.2008 um 21:43 schrieb Mark Volkmann:
(for [x (range 3)] (println x))
for is not a looping construct. for is a list comprehension.
For side effects as above use doseq.
(doseq [x (range 3)] (println x))
Sincerely
Meikel
smime.p7s
Description: S/MIME cryptographic signature
Sorted maps sort only on keys, sorry. I was going to suggest using
(sort-by frest foo) to at least get a sequence in the right order, but
it seems like sorting might be broken at the moment? Looks like this
response has turned into a bug report...
user= (sort [3 1 2])
Oh, nevermind. I hadn't switched my svn over to the Google Code
repository, so I was on 1162... up to 1185 and we're ok.
So yeah.
user= (sort-by frest {:a 2 :b 3 :c 1})
([:c 1] [:a 2] [:b 3])
On Dec 27, 12:50 pm, kwatford kwatf...@gmail.com wrote:
Sorted maps sort only on keys, sorry. I was
I am done with first, rest, ffirst, frest, rfirst, rrest, second. They
are ready for check-in as sequences:
http://intricatevisions.com/source/clojure/sequences.clj
[I don't have rights for clojure-contrib and if somebody is willing to
check it in, please do :-) Please, also adjust
So one thing I don't get is why would tristan's pow code sometimes
generate a BigInteger, and sometimes a Long for the same resulting
number?
But if this is really the problem, it seems like before hashing a
number, Clojure should apply some sort of consistent type conversion
rule to make sure
Hi,
I'm trying union/intersection/difference operations, but
got undefined symbols error:
java.lang.Exception: Unable to resolve symbol: intersection in this
context (NO_SOURCE_FILE:22)
Thanks
Sun
--~--~-~--~~~---~--~~
You received this message because you are
On Saturday 27 December 2008 12:32, wubbie wrote:
Hi,
I'm trying union/intersection/difference operations, but
got undefined symbols error:
java.lang.Exception: Unable to resolve symbol: intersection in this
context (NO_SOURCE_FILE:22)
user= (use 'clojure.set)
nil
user= (doc intersection)
Hi,
Why are they different?
(take 100 (for [x (range 1000) y (range 1000) ( x y)][x y]))
(take 100 (for [x (range 1000) y (range 1000) :when ( x y)][x y]))
Thanks,
Sun
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
On Sat, Dec 27, 2008 at 11:01 PM, wubbie sunj...@gmail.com wrote:
Hi,
Why are they different?
(take 100 (for [x (range 1000) y (range 1000) ( x y)][x y]))
(take 100 (for [x (range 1000) y (range 1000) :when ( x y)][x y]))
Based on the doc string I think the first one should be a syntax
Am 27.12.2008 um 22:40 schrieb wubbie:
I didn't get the syntax error at all:
The first yields: ([0 0] [0 1] ... [0 99])
The second y ields ([0 1] [0 2] .. [0 100])
I don't know why.
Just as Michael said: in the first the ( x y)
is ignored. You can see it in the first item:
[0 0]. This is
Hi all,
Next problem. If I've a collection of sets of letters, and I want all
possible words you can make with this collection if you keep the order
of the sets intact, I would use 'for'. However, for wants me to know
beforehand how many sets there are in my collection. Is there a more
flexible
On Sat, Dec 27, 2008 at 2:18 PM, bOR_ boris.sch...@gmail.com wrote:
but
didn't see an obvious/elegant way to do it in there, and the only way
I'd write it now in clojure is going to be ugly.
Anyone has a suggestion?
This kind of problem is straightforward if you understand recursion,
and
Here's some code that works as I expected:
dyn.clj
(println *value*)
test.clj
(def *value* 'ok)
(defn test-eval []
(load-file dyn.clj))
(test-eval)
= 'ok
But when run in an event handler it fails:
test.clj
(import '(javax.swing JButton JFrame)
Thanks!
On Sat, Dec 27, 2008 at 2:01 PM, Kevin O'Neill ke...@oneill.id.au wrote:
Hi all,
I've updated the github svn clones to pull from google code. I've also
pushed the 20081217 branch so it's now accessible from git.
Any problems please let me know.
-k.
Here's my stab at it.
I'm having problems with the setDescription() line.
Thanks for your help
-Patrick
(ns test)
(gen-class
:name test.MyDerivedClass
:extends [SuperClass]
:init init
:constructors {[] [String]})
(defn -init []
;The following line doesn't work.
;I need to call
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
The first parameter to these functions should be the reference the object.
so try:
(defn -init [this]
(.setDescription this this is a derived class)
On 12/27/2008 08:05 PM, CuppoJava wrote:
Here's my stab at it.
I'm having problems with the
I suggest you start by comparing the current namespace in your
actionPerformed method with that of *value*. Perhaps they are
different.
Bill
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to
Ah thanks Bill well that would explain it!
I added (println DYN: *ns*) to dyn.clj and (println DEF: *ns*) to
def.clj
and this is what I get:
From the command line:
C:\javaclj def.clj
DEF: #Namespace clojure.core
DYN: #Namespace clojure.core
ok
both are in the same namespace
From the REPL:
Here's a related problem. I have a sequence of strings and I'd like to
print each on a separate line. I know that this isn't the answer:
(force (map println results))
I'm not sure what else to try.
On Sat, Dec 27, 2008 at 10:12 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 26.12.2008 um
I believe the first parameter must be this, only in the case of
methods .
The init function doesn't take a this parameter.
Here's an example of my problem, MyDerivedClass is a subclass of
Thread.
This doesn't work, because this actually refers to the first
argument passed to the constructor. It
Meikel's example works fine for strings:
user= (doseq [s [hi mum love u]] (println s))
hi
mum
love u
nil
As does your map:
user= (dorun (map println [hi mum love u]))
hi
mum
love u
nil
--~--~-~--~~~---~--~~
You received this message because you are
... in any case
explicitly setting *ns* works, and really who uses eval/load-file like
this??
Agreed.
Bill
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to
Thanks for the explanation Christophe.
I really need to try use (for) more often. I seem to forget about it
all the time.
On Dec 27, 10:42 pm, Christophe Grand christo...@cgrand.net wrote:
tristan a écrit :
Hi All,
I've been trying to learn clojure lately by solving the project euler
33 matches
Mail list logo