Exactly what I was looking for, thanks!!!
John
On Thursday, May 23, 2013 7:06:39 PM UTC-5, Matthew wrote:
>
> http://www.innoq.com/blog/st/2010/04/clojure_performance_guarantees.html
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to t
http://www.innoq.com/blog/st/2010/04/clojure_performance_guarantees.html
--
--
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 patie
ng about how the java code performs it might be best
>> to specify which one you mean.
>>
>> Yes it's confusing, I'm sure there is a historical reason for it.
>>
>> Timothy
>>
>>
>> On Wed, May 22, 2013 at 8:24 AM, John Jacobsen wrote:
>>
>&
Updated draft of table in more readable form
here: http://bit.ly/big-o-clojure
Thanks to Timothy for corrections/additions! Will keep updating as other
replies come in.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, sen
ava code performs it might be best
> to specify which one you mean.
>
> Yes it's confusing, I'm sure there is a historical reason for it.
>
> Timothy
>
>
> On Wed, May 22, 2013 at 8:24 AM, John Jacobsen
>
> > wrote:
>
>> I should probably also ha
it might be best
to specify which one you mean.
Yes it's confusing, I'm sure there is a historical reason for it.
Timothy
On Wed, May 22, 2013 at 8:24 AM, John Jacobsen wrote:
> I should probably also have added sorted-map to the table, though the
> complexity fo
I should probably also have added sorted-map to the table, though the
complexity for each operation is less clear to me.
--
--
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
then yes, that is
O(n).
Timothy
On Wed, May 22, 2013 at 8:05 AM, John Jacobsen wrote:
> I'm studying for an interview and thought it might be nice to know the
> time complexity of primitive operations on collections in Clojure. A quick
> googling didn't turn up a defini
I'm studying for an interview and thought it might be nice to know the time
complexity of primitive operations on collections in Clojure. A quick
googling didn't turn up a definitive resource. I would be happy to put one
together. What I had in mind was something like:
Collection
Thanks for the snippet Nicolas but that is not the problem! I do know
how to implement the 'undo' functionality...In OOP this is called the
"Command" design pattern...The command interface has execute(from, to)
and undo(from,to) (which calls execute with reversed arguments)...That
part is not h
>
> 1. Gary Bernhardt has been playing with a "new" approach he calls
> "Functional Core, Imperative Shell". Essentially, it's another take on
> the question of how to limit the scope of mutation in order to get the
> most out of the correctness of mutation-free algorithms and the
> performance of
On 26/08/12 09:51, Patryk Bukowinski wrote:
Hi Jim,
Reading your story I've got an impression that you make 'functional'
and 'immutable' a synonym, not default.
Implementation should be more transparent.
In APL func&vect programming languages fammily there are tools which
amends values in pl
Hi Jim,
Reading your story I've got an impression that you make 'functional' and
'immutable' a synonym, not default.
Implementation should be more transparent.
In APL func&vect programming languages fammily there are tools which amends
values in place.
It feels so natural, part of a language used
On Sun, Aug 26, 2012 at 11:16:29AM +0100, Jim - FooBar(); wrote:
> On 26/08/12 11:03, Joshua Ballanco wrote:
> >I would love to have some time to look into the details of your specific
> >problem more, but in the absence of time, might I suggest two quick
> >points:
>
> Well, feel free to have a l
On 26/08/12 11:03, Joshua Ballanco wrote:
I would love to have some time to look into the details of your specific
problem more, but in the absence of time, might I suggest two quick
points:
Well, feel free to have a look at the project on github when you find
some time ( https://github.com/ji
On Sat, Aug 25, 2012 at 09:01:21PM +0100, Jim - FooBar(); wrote:
> Hello everyone,
>
> in this post I'm not asking for something specific, but rather I'd
> like to spark a discussion regarding the issue of performance
> within the functional paradigm...most of the things i will mention
> will pro
+1
i stay functional if possible and fall back to mutable on isolated,
performance critical spots if i can't get it done fast enough in a
purely functional way.
i solved the move-mess-up-everything problem by forcing a move to
implement both apply and unapply on a game board. (it was a java
proje
Hello everyone,
in this post I'm not asking for something specific, but rather I'd like
to spark a discussion regarding the issue of performance within the
functional paradigm...most of the things i will mention will probably
not be news for most of you...Hopefully, however the issues I plan
Hi everyone,
I was in the project euler page and i tried to solve the question 8 using
clojure. No big deal, was really cool.
So , i cant figure out what is the time complexity for the *code* below
I thought that was O(n^2), but running the code for different input seems
that the complexity
Hi,
On 10 Sep., 10:33, Laurent PETIT wrote:
> Maybe when Counted becomes a protocol and is then extended to
> java.lang.String ?
>
> (Does this make sense ?)
Hmmm... Then you can't implement count for seqs anymore. Given you
want the Counted protocol to provide a O(1) count function (really
na
2010/9/10 Meikel Brandmeyer :
> Hi,
>
> On 9 Sep., 21:01, Randy Hudson wrote:
>
>> Inexplicably (counted? "abcd") returns false.
>
> Why should it? String does not implement Counted.
Maybe when Counted becomes a protocol and is then extended to java.lang.String ?
(Does this make sense ?)
--
Yo
Hi,
On 9 Sep., 21:01, Randy Hudson wrote:
> Inexplicably (counted? "abcd") returns false.
Why should it? String does not implement Counted.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cloj
Inexplicably (counted? "abcd") returns false.
On Sep 9, 11:33 am, Sunil S Nandihalli
wrote:
> actually there is a function called
>
> counted?
>
> Sunil.
>
> On Thu, Sep 9, 2010 at 8:59 PM, Nicolas Oury wrote:
> > Thank you very much.
>
> > Never looked closely at count definition.
>
> > I assum
actually there is a function called
counted?
Sunil.
On Thu, Sep 9, 2010 at 8:59 PM, Nicolas Oury wrote:
> Thank you very much.
>
> Never looked closely at count definition.
>
> I assumed it was a forawrd to .count of Counted, which explains my problem.
>
> I kind of remembered the O(1) of Coun
Thank you very much.
Never looked closely at count definition.
I assumed it was a forawrd to .count of Counted, which explains my problem.
I kind of remembered the O(1) of Counted and get mixed up.
Best regards,
Nicolas.
On Thu, Sep 9, 2010 at 3:50 PM, Meikel Brandmeyer wrote:
> Hi,
>
> On 9
Hi,
On 9 Sep., 16:45, Nicolas Oury wrote:
> is it a way to do so?
You can check the Counted marker interface for clojure collections.
But this won't cover Strings etc. More information here:
http://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L489
Sincerely
Meikel
--
Y
Dear all,
I want to write a generic code that use count when it is O(1) and not
when it is not O(n),
is it a way to do so?
Best regards,
Nicolas
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegr
On Mon, Oct 26, 2009 at 6:09 PM, kyle smith wrote:
> Rather than the number of nodes in a tree, I think a better metric
> would be the number of edges in a graph. Variables that are
> referenced on many different lines should get double counted. I think
> this would explain why imperative spagh
On Mon, Oct 26, 2009 at 6:20 AM, Stuart Sierra
wrote:
> Can't be done. Once a fn is compiled, it's just Java bytecode.
On the other hand, size of the generated byte code is moderately
interesting (as is runtime performance in time and heap).
I do *love* the fact that the analysis can be done i
Rather than the number of nodes in a tree, I think a better metric
would be the number of edges in a graph. Variables that are
referenced on many different lines should get double counted. I think
this would explain why imperative spaghetti code is so complex. On
the other hand, I suspect func
On Oct 25, 11:56 pm, MarkSwanson wrote:
> I'd like to run
> count-nodes against a compiled fn that I've previously defined, but I
> could not get an existing fn into quoted form
Can't be done. Once a fn is compiled, it's just Java bytecode.
-SS
--~--~-~--~~~---~--~-
Hi,
On Oct 26, 7:08 am, John Harrop wrote:
> > (count-nodes "abcde")
> > ; 6
>
> Yikes.
>
> Maybe special-casing strings would be best: change (seqable? x) into (and
> (seqable? x) (not (string? x))). I don't know if Seqable is synonymous with
> that; might there be other seqable?s that
On Mon, Oct 26, 2009 at 1:09 AM, Chouser wrote:
>(count-nodes "abcde")
>; 6
Yikes.
Maybe special-casing strings would be best: change (seqable? x) into (and
(seqable? x) (not (string? x))). I don't know if Seqable is synonymous with
that; might there be other seqable?s that aren't Seq
On Mon, Oct 26, 2009 at 12:45 AM, Timothy Pratley
wrote:
>
> This sounds like a neat idea to me. Maybe the way to get the
> 'complexity' is to calculate it at definition, this macro doesn't work
> for obvious reasons:
> (defmacro defnc
> [n & body]
> `(l
y seconds
> to hack something in Clojure:
>
> user=> (defn count-nodes [data] (if (clojure.contrib.core/seqable? data) (+
> 1 (reduce + 0 (map count-nodes data))) 1))
> #'user/count-nodes
> user=> (count-nodes '(+ 3 (* 2 7)))
> 7
Fun!
> The count-nodes functi
This sounds like a neat idea to me. Maybe the way to get the
'complexity' is to calculate it at definition, this macro doesn't work
for obvious reasons:
(defmacro defnc
[n & body]
`(let [f# (defn ~n ~...@body)]
(alter-meta! (var ~n) assoc :complexity (count-nodes ~bod
On Sun, Oct 25, 2009 at 11:56 PM, MarkSwanson wrote:
> I'm curious (general Clojure question) about your use of the quoted
> form. The Clojure docs state that this results in an unevaluated form,
> but I had trouble finding more details on this. F.E. I'd like to run
> count-nodes against a compile
st(i.next());
0 }
0 }
3 return result;
0 }
0 }
84
This is the closest possible Java to the loop-recur implementation. It's
about 68% larger in complexity by the AST-size metric.
--~--~-~--~~~---~--~~
You received this message
That's interesting.
I ran this against a quoted Clojure fn of mine and received 92.
I'm curious (general Clojure question) about your use of the quoted
form. The Clojure docs state that this results in an unevaluated form,
but I had trouble finding more details on this. F.E. I'd like to run
count
nodes. The
example uses a simple math calculation and correctly counts seven nodes:
five leaves (three integer literals and two symbols) and two non-leaf nodes
(one for the product and one for the sum).
The count-nodes function itself has a code complexity of 22 by the same
measure:
user=> (c
t 2, :prio 10, :count 3, :rest {:first 3, :prio 4, :count
> 2, :rest {:first 4, :prio 1, :count 1, :rest nil}}}
> user=> (:first (:rest pq))
> 3
>
> Kind regards,
> achim
>
> Am 01.03.2009 um 06:31 schrieb zoglma...@gmail.com:
>
>
>
> > After helping
ure as a mutable
> data structure. It was straight forward, but curiosity struck and I
> implemented the priority queue as an immutable data structure. I'm
> pretty sure that 'ffirst 'first 'count and 'rest have a constant time
> complexity, but it is a little
that 'ffirst 'first 'count and 'rest have a constant time
complexity, but it is a little hard to wrap my mind around this code.
Is it really constant time?
;- immutiable priority queue -
(defn priority-cons [priority data queue]
(defstruct element :priority :data)
(
On Oct 3, 5:21 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
> Yes. If it is important to get access bounded by the subvector's N you
> can just call vec on it, at a one-time O(subvecN) cost.
>
> It is important to note that for vectors that are created by vec (and
> literals) that have never been up
On Oct 3, 10:59 am, Cesare <[EMAIL PROTECTED]> wrote:
> On Oct 3, 4:42 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> > On Oct 3, 10:12 am, Cesare <[EMAIL PROTECTED]> wrote:
> > Subvectors can be created in constant time because they copy nothing
> > and share structure with the original. So, th
On Oct 3, 4:42 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Oct 3, 10:12 am, Cesare <[EMAIL PROTECTED]> wrote:
> Subvectors can be created in constant time because they copy nothing
> and share structure with the original. So, they are effectively views
> on the original vector, and share its a
On Oct 3, 10:12 am, Cesare <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm reading the Clojure documentation and there is something I don't
> understand about vector functions.
>
> "Vectors support access to items by index in log32N hops"
>
> but this seems in contrast with the fact that 'subvec' i
Hi All,
I'm reading the Clojure documentation and there is something I don't
understand about vector functions.
"Vectors support access to items by index in log32N hops"
but this seems in contrast with the fact that 'subvec' is O(1) (few
lines later).
If subvec was O(1), it would be possible t
48 matches
Mail list logo