Hey!
As a learning exercise I wrote a simple boggle solver in clojure.
I'm sure there is lots of room for improvement to make it more
idiomatic and perform better so I would be grateful if anyone would
care to cast their eye over it.
http://wiki.github.com/phraemer/Boggle-Solver
thanks,
James
Um, I use butterflies?
On Nov 6, 5:35 pm, John Harrop wrote:
> On Fri, Nov 6, 2009 at 7:41 PM, Tim Dysinger wrote:
> > Use emacs! It formats your code while you type :)
>
> Nasty side effect though -- it formats your brain while you type, too.
> Eventually you wind up a gibbering lunatic. :) I'
Perhaps xml/parse shouldn't fetch the DTD, as per the W3C
recommendation?
On Nov 7, 2:46 am, Christophe Grand wrote:
> The w3c filters traffic to DTDs, see here for more
> details:http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic
>
> Christophe
>
>
>
>
>
> On Sat, Nov 7, 20
Can I play too?
Non-lazy version (basically the same as Chouser's with reduce instead of loop):
(defn partition-when [pred coll]
(reduce #(if (pred %2)
(conj %1 [%2])
(conj (pop %1) (conj (peek %1) %2)))
[[]] coll))
user=> (partition-when odd? (range 1 15)
I can't figure out how to avoid reflection, in the 'update' method of
MessageDigest. It is overloaded on a single argument with either
'byte', 'byte[]', or 'java.nio.ByteBuffer'.
(import '(java.security MessageDigest))
(set! *warn-on-reflection* true)
The compiler didn't seem to like a ta
On Sat, Nov 7, 2009 at 10:41 AM, David Brown wrote:
>
> I can't figure out how to avoid reflection, in the 'update' method of
> MessageDigest. It is overloaded on a single argument with either
> 'byte', 'byte[]', or 'java.nio.ByteBuffer'.
>
> (import '(java.security MessageDigest))
> (set! *
On 07.11.2009, at 15:07, Joubert Nel wrote:
>
> Perhaps xml/parse shouldn't fetch the DTD, as per the W3C
> recommendation?
>
It's highly likely it's the underlying Java parser that does so (even
though it doesn't need to) - the same problem would be there if a Java
program running in the sa
Thank you Tim,
I certainly appreciate information like this!
I am busy writing a paper for the IEEE conference later on in 2010. Its for
my honours university work. Bluetooth social messaging and proximity related
activities in and around the university campus.
I have done a lot of work with JAV
A couple of months ago I saw a web site that provided a web-based REPL
for many programming languages including Clojure. I can't find it now.
Does anybody have that URL?
--
R. Mark Volkmann
Object Computing, Inc.
--~--~-~--~~~---~--~~
You received this message be
On Sat, Nov 07, 2009 at 11:48:32AM -0500, Chouser wrote:
>This should work:
>
>(defn update1 [#^MessageDigest md, #^bytes item]
> (.update md item))
This does seem to work, thanks.
Any reason that 'doubles' is also defined as an array cast function,
but 'bytes' is not?
David
--~--~--
On Sat, Nov 7, 2009 at 2:57 PM, David Brown wrote:
>
> On Sat, Nov 07, 2009 at 11:48:32AM -0500, Chouser wrote:
>
>>This should work:
>>
>> (defn update1 [#^MessageDigest md, #^bytes item]
>> (.update md item))
>
> This does seem to work, thanks.
>
> Any reason that 'doubles' is also defi
On Sat, Nov 7, 2009 at 2:50 PM, Mark Volkmann wrote:
>
> A couple of months ago I saw a web site that provided a web-based REPL
> for many programming languages including Clojure. I can't find it now.
> Does anybody have that URL?
Perhaps this one on Google AppEngine?
http://lotrepls.appspot.co
I'm trying to do this:
(defmacro my-defn [name & body]
`(defn- #^{ :foo-tag "blah" } ~name []
~...@body))
The idea is that foo will be defined and that {:foo-tag "blah"} is
added to its meta-data.
But that does not seem to work:
user> (my-defn foo (println "Hello"))
#'user/foo
use
Stefan Arentz wrote:
>
> I'm trying to do this:
>
> (defmacro my-defn [name & body]
>`(defn- #^{ :foo-tag "blah" } ~name []
> ~...@body))
>
> The idea is that foo will be defined and that {:foo-tag "blah"} is
> added to its meta-data.
>
> But that does not seem to work:
Try this:
>> The idea is that foo will be defined and that {:foo-tag "blah"} is
>> added to its meta-data.
... and to explain *why*:
user=> (pprint
(read-string "(defmacro my-defn [name & body]
`(defn- #^{ :foo-tag \"blah\" } ~name []
~...@body))"))
(defmacro
my-defn
[name & body]
(clojur
Another one related to my previous question about meta-data.
user> (defn #^{ :xxx 1} foo [] "foo")
#'user/foo
user> (defn #^{ :xxx 2} bar [] "bar")
#'user/bar
I need to do something similar to this:
user> (map #(:xxx (meta %)) [foo bar])
(nil nil)
Basically accessing the meta data of a functio
On Sat, Nov 7, 2009 at 8:04 PM, Stefan Arentz wrote:
> But I'm using this in a bigger macro that takes a bunch of functions
> as a parameter. Is there a way to make this work or should I
> 'translate' the functions that I take by name with (var foo)?
You'll need to translate the symbols into va
On 2009-11-07, at 8:28 PM, John Harrop wrote:
> On Sat, Nov 7, 2009 at 8:04 PM, Stefan Arentz
> wrote:
> But I'm using this in a bigger macro that takes a bunch of functions
> as a parameter. Is there a way to make this work or should I
> 'translate' the functions that I take by name with (va
On Sat, Nov 7, 2009 at 8:34 PM, Stefan Arentz wrote:
> On 2009-11-07, at 8:28 PM, John Harrop wrote:
>
> > On Sat, Nov 7, 2009 at 8:04 PM, Stefan Arentz
> > wrote:
> > But I'm using this in a bigger macro that takes a bunch of functions
> > as a parameter. Is there a way to make this work or sho
Stefan Arentz wrote:
> I must admin that I don't fully understand the difference between foo
> and #'foo. That is probably why I'm making this beginner mistake :-)
The difference takes some explanation. So without further ado...
Functions and Metadata: in Vivacious Gory Detail
==
On Nov 6, 12:10 pm, John Harrop wrote:
> On Fri, Nov 6, 2009 at 1:07 PM, John Harrop wrote:
> > On Fri, Nov 6, 2009 at 1:01 PM, Warren Wood
> > wrote:
>
> >> In the meantime, I came up with the following, which seems to work.
> >> I'm sure it can be improved.
>
> >> (defn NOT [pred] (fn [x] (
Thanks, that was indeed helpful!
On Nov 6, 6:47 pm, Alex Osborne wrote:
> Alex Osborne wrote:
> > Like Mark's but using split-with instead of split-at:
>
> > (defn partition-when [pred coll]
> > (lazy-seq
> > (when-let [[x & xs] (seq coll)]
> > (let [[xs ys] (split-with (complement
user=> (def q 'G__723)
#'user/q
user=> (def r (gensym))
#'user/r
user=> q
G__723
user=> r
G__723
user=> (= q r)
true
It's possible to anticipate the next gensym name that will be generated and
then engineer a collision, and therefore possibly variable capture
unintended by the author of a macro.
Thought of this, which I like better. Again, I'm surprised if
conjunction is not already a standard function, but I can't find it.
I'm still a bit tempted to call it AND for readabilty of code. (I
spent some time studying combinatory logic back in the day. (I even
had a "Curry Fellowship" at Pe
Hmm, someone else has made another "closure" available :).
http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html
-Adrian.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to t
On Nov 8, 6:08 am, Adrian Cuthbertson
wrote:
> Hmm, someone else has made another "closure" available :).
>
> http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html
There's also Clozure Common Lisp [1], which is conceptually closer to
Clojure.
[1] http://www.clozure.com/clozurec
26 matches
Mail list logo