Laurent PETIT writes:
Hi Laurent,
> Was playing with levenshtein (argh, where do I place the h -sorry
> mister levenshtein-), and thougth it could be interesting to share my
> current result here, to get some feedback.
Looks really concise. Nice!
> The following version works with any seq-abl
>
> Am I missing something?
>
types.
--
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 new members are moderated - please be patient with your
first post.
To unsubscrib
Just thinking out loud...
After listening to "classes are a premature optimization" lecture on infoQ
.. I was just wondering if the only purpose of defrecord is space&speed
efficiency ... and could just use maps .. ofcourse .. I won't be able to use
the protocols ..defrecord may improve the readabi
Laurent,
I have been doing some work on a diff library for Clojure sequences (I
need to get back to it and finish it up).
http://github.com/brentonashworth/clj-diff
The main goal of this library is to compute sequential diffs quickly.
Whenever I see someone doing something similar I like to comp
I'm having a bit of trouble getting type hinting to work. I've got
these equal sized seqs that I'm mapping into a function. I'm running
the function twice in a row in an inner loop that is seriously
dragging down performance.
(let [ newv1 (time (doall (map (fn [v u I] (+ ^java.lang.Double v (*
Hello, all,
Over the past week and a half or so, I have been working on getting
Clojure working fully on Android. At last, I have released a Clojure
REPL that is now available on the Android Market.
For now it is primarily a proof-of-concept, so it does not include much
in the way of features as
I'm with Andreas, and would love some help dissecting this a bit
further.
On Feb 15, 6:53 pm, Andreas Kostler
wrote:
> Laurent,
> I've been studying your implementation for a while now and can't really fully
> grasp it.
> Can you elaborate a bit on the algorithm?
> Cheers
> Andreas
>
> On 16/02/
On Tue, Feb 15, 2011 at 10:02 AM, Marko Topolnik
wrote:
>> > Is really any call that isn't inlined that expensive?
>>
>> Yes, unfortunately. You saw the numbers. :)
>
> If you mean the earlier thread about the Euler problem, I see that the
> diagonal-sum-3 drastically outperforms diagonal-sum-2 by
Laurent,
I've been studying your implementation for a while now and can't really fully
grasp it.
Can you elaborate a bit on the algorithm?
Cheers
Andreas
On 16/02/2011, at 9:45 AM, Stuart Sierra wrote:
> Cool! That's a very compact implementation.
>
> Could the same technique be adapted to gi
2011/2/16 Sean Corfield
> On Tue, Feb 15, 2011 at 3:11 PM, Raoul Duke wrote:
> > you might also sorta be saying that there are lots of different kinds
> > of polymorphism in programming, and that we need to know when to/not
> > use any given form of it, which i'd agree with :-)
>
> We're probabl
There are two very interesting threads over on the Scala mailing lists
at the moment that have some bearing on this thread - and I think
illustrate the two very different ways of thinking about types and
type systems:
Benefits of static typing:
http://groups.google.com/group/scala-debate/browse_th
On Tue, Feb 15, 2011 at 3:11 PM, Raoul Duke wrote:
> you might also sorta be saying that there are lots of different kinds
> of polymorphism in programming, and that we need to know when to/not
> use any given form of it, which i'd agree with :-)
We're probably in violent agreement, yeah :)
I th
On 15 February 2011 22:53, MS <5lvqbw...@sneakemail.com> wrote:
>> So an electrical circuit is a data structure containing vertices and
>> edges and describing how they are connected. Then you'll have some
>> functions that operate on that data structure.
>
> So... how do I use someone else's imple
Cool! That's a very compact implementation.
Could the same technique be adapted to give you the longest common
substring?
e.g. (foo "fooba" "baab") => "ba"
Or better yet, the length of the longest common substring and the starting
indices of each common substring of that length,
e.g. (foo "baa
This is a bug. I created CLJ-739 for it.
http://dev.clojure.org/jira/browse/CLJ-739
Thanks for the report, Olek!
-Stuart Sierra
clojure.com
--
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
Since about 1.1, I think, the Clojure compiler calls String.intern() on
String literals. So yes, they are the same object.
-Stuart Sierra
--
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
On Tue, Feb 15, 2011 at 3:03 PM, Sean Corfield wrote:
> If polymorphism is the appropriate solution, yes. But for a lot of
> people steeped in OO thinking, polymorphism is a bit of a hammer for
> every problem that looks like a nail.
you might also sorta be saying that there are lots of different
On Tue, Feb 15, 2011 at 2:53 PM, MS <5lvqbw...@sneakemail.com> wrote:
> Because I'm not sure how else to use (for example) a graph library and
> still have it look like a circuit, rather than a graph.
Almost any such graph library is going to be a bunch of functions that
operate on a data structur
On Tue, Feb 15, 2011 at 1:58 PM, Raoul Duke wrote:
> because polymorphism makes code suck less, if done well.
If polymorphism is the appropriate solution, yes. But for a lot of
people steeped in OO thinking, polymorphism is a bit of a hammer for
every problem that looks like a nail. I don't find
Cool, thanks for the tips. More inline below:
>
> > For example, I'm trying to figure out how to do polymorphism in FP.
>
> Why?
Because I'm not sure how else to use (for example) a graph library and
still have it look like a circuit, rather than a graph.
>
> > Specifically, an electrical circu
Thanks, I have HTDP on my computer but after the first chapter I got
distracted and have been meaning to get to itI'll look for my
answers there! :)
On Feb 15, 1:13 pm, Raoul Duke wrote:
> On Tue, Feb 15, 2011 at 1:12 PM, Raoul Duke wrote:
> > for a functional take:
> >http://ac.aua.am/triet
Hi,
Was playing with levenshtein (argh, where do I place the h -sorry mister
levenshtein-), and thougth it could be interesting to share my current
result here, to get some feedback.
The following version works with any seq-able (not only Strings), but
hardwires function = for equality testing of
On Tue, Feb 15, 2011 at 1:55 PM, Sean Corfield wrote:
> On Tue, Feb 15, 2011 at 12:04 PM, MS <5lvqbw...@sneakemail.com> wrote:
>> For example, I'm trying to figure out how to do polymorphism in FP.
> Why?
because polymorphism makes code suck less, if done well. see
"typeclasses" in haskell for an
On Tue, Feb 15, 2011 at 12:04 PM, MS <5lvqbw...@sneakemail.com> wrote:
> Maybe my mind has been polluted by OO concepts.
I was having this discussion on another list and it seems that the
less OO folks know, the easier they find FP... so you may well be
right :)
> For example, I'm trying to figur
On Tue, Feb 15, 2011 at 1:12 PM, Raoul Duke wrote:
> for a functional take:
> http://ac.aua.am/trietsch/web/Critical%20Path_Holistic%20Approach_final.pdf
aw, crap.
http://www.htdp.org/
is the link i really wanted to copy-paste. (i think the one i did
paste is good reading if you are a proce
On Tue, Feb 15, 2011 at 1:07 PM, Saul Hazledine wrote:
> On Feb 15, 9:04 pm, MS <5lvqbw...@sneakemail.com> wrote:
>> Maybe my mind has been polluted by OO concepts.
> Maybe a combination of OO and static typing.
for a functional take:
http://ac.aua.am/trietsch/web/Critical%20Path_Holistic%20Appr
On Feb 15, 9:04 pm, MS <5lvqbw...@sneakemail.com> wrote:
> Hi, I just (mostly) finished reading the Programming Clojure book and
> while it gave a great overview of the language, I'm still at a loss
> for how to design programs.
>
You'll get better answers later but here is my take on it.
> Maybe
On Feb 14, 11:13 pm, Andreas Kostler
wrote:
> Does anyone wanna have a look at my solution for Project Euler Problem 28?
>
> (defn diagonal-sum [n-max]
> (+ 1 (reduce +
> (map (fn[n]
> (reduce + (map #(- (* n n) (* % (- n 1))) (range 4
>
Hi, I just (mostly) finished reading the Programming Clojure book and
while it gave a great overview of the language, I'm still at a loss
for how to design programs.
Maybe my mind has been polluted by OO concepts.
For example, I'm trying to figure out how to do polymorphism in FP.
Specifically, a
Hello everyone.
I am using clojure-clr.
I have compiled a simple hello world console application.
However when I try to run the app I get:
Unhandled Exception: System.TypeInitializationException: The type
initializer fo
r 'HelloWorld' threw an exception. --->
System.IO.FileNotFoundException: Co
My version follows the same algorithm (and so runs in the same amount
of time), just arranged differently:
(defn corner-nums [n]
(for [i (range 4)]
(- (* n n) (* i (dec n)
(defn sum-all-corner-nums [max-n]
(let [ns (range 3 (inc max-n) 2)
all-corner-nums (mapcat corner-nums ns
For compilation and evaluation, yes. But not strings created at
rumtime like:
(def foo (str \f \o \o))
http://groups.google.com/group/clojure/browse_thread/thread/e43af17a0424b1cd
On Feb 15, 2:46 am, "C. Arel" wrote:
> Hi all,
> I am watching the data structure videos and there it evaluates to
>
> > Is really any call that isn't inlined that expensive?
>
> Yes, unfortunately. You saw the numbers. :)
If you mean the earlier thread about the Euler problem, I see that the
diagonal-sum-3 drastically outperforms diagonal-sum-2 by eliminating
HOFs and working with unchecked primitive ops. Elimi
On Tue, Feb 15, 2011 at 11:46, C. Arel wrote:
> Hi all,
> I am watching the data structure videos and there it evaluates to
> false.
> Does this mean that only one object is created now? (Clojure update on
> String objects?)
I think this is a distinction without a difference since Strings are
imm
On Feb 14, 2011, at 8:21 PM, Michael Ossareh wrote:
>
> Along with anything that is listed in :repositories in your project.clj ?
+1
--
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
No
Hi!
I managed to get to a "Hello world" level using appengine-magic, plus an
Emacs Swank/Slime setup.
While I'm pretty sure I won't look back to Python regarding the language
itself, I already miss the speed and simplicity of just saving,
switching to a browser, reloading and seeing results.
Hi all,
I am watching the data structure videos and there it evaluates to
false.
Does this mean that only one object is created now? (Clojure update on
String objects?)
Kind Regards,
Can
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this
On Tue, Feb 15, 2011 at 3:52 AM, Marko Topolnik
wrote:
>> 4. Unless you're using 1.3 or later, put the innermost loop in a
>> single function and try to avoid calling sub-functions, except for
>> operators like + that can get inlined.
>
> This is interesting, can you be more specific about this po
Very sorry. I should have searched before I wrote.
http://groups.google.com/group/clojure/msg/fb9930ba2a25d2dd
On Feb 15, 11:00 am, Saul Hazledine wrote:
> Hello,
> Apologies if this there is an obvious documented answer to this
> question. If I write a function:
>
> (defn example
>
Hello,
Apologies if this there is an obvious documented answer to this
question. If I write a function:
(defn example
"Get info about a function"
[f]
(println "Arity is" (arity f))
(if (is-anonymous? f)
(println "Function is anonymous")))
I believe I can impl
Hi,
In 1.2 (line core.clj:5466) and 1.3 (line core.clj:5911) versions of
Clojure, opened stream for reading clojure-version is not closed what
causes problems in JEE env.
Cheers,
Olek
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this
> 4. Unless you're using 1.3 or later, put the innermost loop in a
> single function and try to avoid calling sub-functions, except for
> operators like + that can get inlined.
This is interesting, can you be more specific about this point -- what
exactly do we need to avoid? Calls that force the
On Tue, Feb 15, 2011 at 2:59 AM, Ken Wesson did NOT write:
> (defn diagonal-sum-4 [n-max]
> (let [cores (.availableProcessors (Runtime/getRuntime))
> step (* 2 cores)]
> (inc
> (reduce +
> (map get
> (doall
> (map #(future (diagonal-sum-4a n-max % step))
On Tue, Feb 15, 2011 at 1:13 AM, Andreas Kostler
wrote:
> Hi all,
> Does anyone wanna have a look at my solution for Project Euler Problem 28?
>
> (defn diagonal-sum [n-max]
> (+ 1 (reduce +
> (map (fn[n]
> (reduce + (map #(- (* n n) (* % (- n 1))) (range
44 matches
Mail list logo