re: functional == slow

2015-05-15 Thread Raoul Duke
at least, it often feels like that is the practical reality cf. clojure vs. java; f# vs. c#; haskell vs. c -- oh, wait a minute: http://www.cs.ru.nl/P.Achten/IFL2013/symposium_proceedings_IFL2013/ifl2013_submission_20.pdf -- You received this message because you are subscribed to the Google Group

Re: Why does the following Clojure code take 10x the time the C# version does? How to improve the Clojure version?

2015-05-15 Thread Steven Yi
Ah, I see. Well, I think then you can ignore the stuff about warming up, as this certainly takes a while to run here: "Elapsed time: 314763.93 msecs" I tried profiling with Yourkit and saw a couple of things to change: ;; I think lte with more than two args ends up being slower than unrolli

Re: Why does the following Clojure code take 10x the time the C# version does? How to improve the Clojure version?

2015-05-15 Thread Amith George
Hi Steven, My bad. You need to invoke the code using the command lein run -m rdp.214-intermediate-arr 1 true The `1` tells it to select a certain input file, (in this case the biggest) and the `true` tells it to use the function that internally uses a java array (as opposed to the function th

Re: Why does the following Clojure code take 10x the time the C# version does? How to improve the Clojure version?

2015-05-15 Thread Steven Yi
Hi Amith, I checked out your project from git and just doing 'lein run' I got a reported: "Elapsed time: 185.651689 msecs" However, if I modify the -main function in 214_intermediate.clj to wrap the time testing with (doseq [_ (range 20)]), to run the test multiple times, the behavior is much

Re: Protocols/multimethods vs core.match

2015-05-15 Thread Timothy Baldridge
No, it actually compiles down to a pile of ifs, and try/catch/throws (for backtracking). It's pretty fast, but it won't be as fast as a jump table for complex matches, that's for sure. Timothy On Fri, May 15, 2015 at 5:53 PM, Surgo wrote: > core.match compiles down to case, does it not? So the

Re: Protocols/multimethods vs core.match

2015-05-15 Thread Surgo
core.match compiles down to case, does it not? So the comparisons here are similar: http://insideclojure.org/2015/04/27/poly-perf/ -- Morgon On Friday, May 15, 2015 at 2:57:23 PM UTC-4, tbc++ wrote: > > One big thing to consider is that core.match is closed dispatch. If you > write a function t

Re: Multimethod or protocol or...? Clojure design feedback

2015-05-15 Thread Luc Préfontaine
I regroup these name spaces in an api name space and require this name space where it makes sense. You can cut out your APIs as you wish around one or more mutli methods and add whatever stuff needs to be part of it. Still manually managed but not scattered everywhere. Never thought of a differ

Re: [ANN] darwin and algebolic - genetic algorithms, and evolving mathematics

2015-05-15 Thread Lee Spector
Fantastic to see this Jony! I look forward to checking it out in detail. Those interested in genetic programming in Clojure might also want to check out: - https://github.com/lspector/gp (minimalist tree-based genetic programming implementation, written for educational purposes but maybe useful

[ANN] darwin and algebolic - genetic algorithms, and evolving mathematics

2015-05-15 Thread Jony Hudson
Hi All, it's my pleasure to share with you two libraries: darwin and algebolic. Algebolic is a library for evolving mathematical expressions. You can use it to perform what's known as symbolic regression, where a symbolic mathematical expression is found that fits a given dataset. More general

Re: Multimethod or protocol or...? Clojure design feedback

2015-05-15 Thread Jason Marmon
Thanks for the feedback guys. Another related Q: The user needs to require the namespace that those defmethods are defined in for the multi to know about it. Presumably each defmethods will be in individual files, meaning the user has to require all those files for the migration tool to work. Is

Re: Protocols/multimethods vs core.match

2015-05-15 Thread Timothy Baldridge
One big thing to consider is that core.match is closed dispatch. If you write a function that uses core.match, I can't extend it inside my code. This is something that is possible with both multi-methods and protocols. Timothy On Fri, May 15, 2015 at 12:49 PM, Sam Raker wrote: > The discussion/

Protocols/multimethods vs core.match

2015-05-15 Thread Sam Raker
The discussion/post-linked-to in https://groups.google.com/d/msg/clojure/eoAp6QVimYI/iipmEJNKdrIJ have got me thinking about protocols & multimethods, which I admittedly have possibly never actually used, now that I think about it. I'm wondering how they differ from core.match[1]. I realize pro

Re: Code Review

2015-05-15 Thread Sven Richter
Thanks to both of you, this looks more like what I am used to with clojure. The transpose function is the trick here :-) Best Regards, Sven Am Freitag, 15. Mai 2015 10:35:11 UTC+2 schrieb Ray Miller: > > If I've understood the problem correctly, you can simplify the code by > implementing a tra

Re: Why does the following Clojure code take 10x the time the C# version does? How to improve the Clojure version?

2015-05-15 Thread Lee Spector
Thanks Jony -- very helpful! -Lee > On May 15, 2015, at 7:52 AM, Jony Hudson wrote: > > @puzzler -server is the default mostly, but Leiningen overrides some of the > important options that -server enables, as detailed by Alex. > > @Lee the first 15 minutes of this talk by Tom Crayford has so

Re: Why does the following Clojure code take 10x the time the C# version does? How to improve the Clojure version?

2015-05-15 Thread Jony Hudson
@puzzler -server is the default mostly, but Leiningen overrides some of the important options that -server enables, as detailed by Alex. @Lee the first 15 minutes of this talk by Tom Crayford has some useful info about performance and JVM options in it: https://skillsmatter.com/skillscasts/6148

Re: Code Review

2015-05-15 Thread Ray Miller
If I've understood the problem correctly, you can simplify the code by implementing a transpose function: (defn transpose [xs] (apply map vector xs)) Then define a wanted? function for filtering the lines you want to include: (defn wanted? [xs] (some zero? xs)) ...and a helper function to left-

Re: Code Review

2015-05-15 Thread Ralf Schmitt
Sven Richter writes: > HI, > > I just posted a question to stackoverflows code review > page:http://codereview.stackexchange.com/questions/90809/remove-lines-from-a-2d-vec-in-clojure > > As there is not much traffic regarding clojure I also double post to this > list in the hope to get some goo

Code Review

2015-05-15 Thread Sven Richter
HI, I just posted a question to stackoverflows code review page:http://codereview.stackexchange.com/questions/90809/remove-lines-from-a-2d-vec-in-clojure As there is not much traffic regarding clojure I also double post to this list in the hope to get some good answers. You might respond here o

Managing database schema

2015-05-15 Thread René Groß
I can suggest https://github.com/teropa/lein-flyway, which wraps the functionality of flyway into leiningen commands. -- 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 n

Re: Why does the following Clojure code take 10x the time the C# version does? How to improve the Clojure version?

2015-05-15 Thread Amith George
Thanks for the detailed suggestions. Implementing them did bring the execution time down to around 250secs. Though that value is still much longer than 45secs. Could you please verify if I have implemented them correctly? Code - https://github.com/amithgeorge/reddit-dailyprogrammer-clojure/blo

Re: a record that implements the iFn protocol can itself be called as a function?

2015-05-15 Thread skuro
Why not trying it right away in the REPL? user=> (defrecord Bar [state]) ; <- not implementing IFn > user.Bar > user=> ((->Bar "foo")) > ClassCastException user.Bar cannot be cast to clojure.lang.IFn > user/eval15532 (form-init5689008917050406381.clj:1) > user=> (defrecord Foo [state] clojure