Re: Doseq, map-style

2012-06-10 Thread David Jacobs
I agree that it probably doesn't need to be a macro (your second suggestion was my first inclination). I didn't realize doseq took keyword options, that's good to know. On Saturday, June 9, 2012 at 7:51 PM, Walter Tetzner wrote: > > Is there a philosophical difference underlying the syntax

Re: Doseq, map-style

2012-06-10 Thread Meikel Brandmeyer
Hi, Beware the personal opinion! map applies a function to each element of a sequence and returns a sequence of the results. If you call the "function" just for side-effects, but not the return value, then the semantics of map don't apply. Kind regards Meikel -Ursprüngliche Nachricht

Re: Why isn't there a fold-right?

2012-06-10 Thread Tassilo Horn
Yoshinori Kohyama writes: Hi! > Here is my fold-right. > > (defn fold-right [f s coll] > ((reduce (fn [acc x] #(acc (f x %))) identity coll) s)) Very elegant, but sadly it blows the stack on larger collections. On my system, the threshold is somewhere beetween 15.000 and 16.000 elements. So

Re: [PATCH] RFC: Add Functions `tabify` And `untabify`

2012-06-10 Thread OGINO Masanori
Hello. > Please don't misinterpret my comments as saying you're wasting time. > By all means, keep working on this. `tabify` and functions like it > could be useful to others, I just don't know yet. I see. > If you can demonstrate an improvement to clojure.repl by adding these > functions, then

Re: Abridged summary of clojure@googlegroups.com - 28 Messages in 7 Topics

2012-06-10 Thread clifford goldberg
On 02 Jun 2012 1:57 AM, wrote: > Today's Topic Summary > > Group: http://groups.google.com/group/clojure/topics > >- When arithmetic on a computer bite > back<#137aa7bd6d6d4f87_group_thread_0>[3 Updates] >- using -> on a nested hash-map with string > keywords.<#137aa7bd6d6d4f87_group

[PATCH] Enhance clojure.data/diff to cope with falsey values in maps

2012-06-10 Thread Philip Aston
Current behaviour of clojure.data/diff: => (diff {:a false} {:a true}) (nil {:a true} nil) => (diff {:a false} {:a nil}) (nil nil nil) With patch: => (diff {:a false} {:a true}) ({:a false} {:a true} nil) => (diff {:a false} {:a nil}) ({:a false} {:a nil} nil) This seems more consistent and us

Re: Function minimizer a la fminunc

2012-06-10 Thread Lachlan
maybe http://commons.apache.org/math/apidocs/index.html will help? - lk On Jun 10, 2012 7:09 AM, "David Jacobs" wrote: > Thanks! That section of Incanter must be new, I haven't seen it till now. > Will check it out and report back. > > > On Friday, June 8, 2012 at 7:15 AM, Lars Nilsson wrote: >

Re: Explaining the thrush -> operator.

2012-06-10 Thread Tim Visher
On Fri, Jun 8, 2012 at 2:02 PM, fenton wrote: > I created a tutorial explaining what the thrush -> and ->> operator is. > > https://github.com/ftravers/PublicDocumentation/blob/master/clojure-thrush.md > > My tutorials are aimed at people who appreciate VERY explicit explanations, > which I think

Re: Explaining the thrush -> operator.

2012-06-10 Thread Ulises
Additional to all the positive comments, I'd suggest you use an operator which is not commutative, otherwise the differences between -> and ->> are less evident. U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to c

clashing methods between 2 different protocols???

2012-06-10 Thread Jim - FooBar();
Hello everyone, I am completely and utterly confused about this error that I just got: Warning: protocol #'Clondie24.core/MoveCommand is overwriting method toString of protocol Piece (defprotocol MoveCommand "The Command design pattern in action." (execute [this]) (undo[this]) (getM

Re: clashing methods between 2 different protocols???

2012-06-10 Thread Jim - FooBar();
Ok sorted... in case someone else is confused by this, this is how you can override the toString method on records: (defrecord CheckersMove [^CheckersPiece p ^clojure.lang.PersistentVector start-pos ^clojure.lang.PersistentVector end-pos] Mo

ANN: lein-guzheng 0.3.0, now with lein2 support

2012-06-10 Thread David Greenberg
After much toiling, I've made lein-guzheng compatible with lein2 as well as lein1. The syntax is the same: "lein2 guzheng foo.core foo.util -- test" or any other namespace you'd like to trampoline to. Use [lein-guzheng "0.3.0"] to get it. It will work with lein1 and lein2. https://github.com/dgrn

clj-pdf for declarative PDF generation (status update)

2012-06-10 Thread Dmitri
The goal of clj-pdf is to provide a straight forward way to generate PDFs using markup similar to hiccup. It tries to do the right thing by default, so all styling hints are optional. It's getting some production use at the moment, and there don't appear to be any issues so far. https://github

Re: clj-pdf for declarative PDF generation (status update)

2012-06-10 Thread Moritz Ulrich
Looks cool! Unfortunately I currently don't have the time to have a deep look at it. However, I have a small comment on the api: Many parameters like 'style', 'size', 'orientation', etc. use strings for their values. I think keywords would be a better fit there. On Sun, Jun 10, 2012 at 5:59 PM, Dm

Re: clj-pdf for declarative PDF generation (status update)

2012-06-10 Thread Dmitri
The reason I'm using strings for values is to make it easier to work with deserialized JSON. Currently I have it running as a service that our internal applications send a JSON request and get a PDF document back. On Sunday, June 10, 2012 12:25:39 PM UTC-4, Moritz Ulrich wrote: > > Looks cool!

Re: Explaining the thrush -> operator.

2012-06-10 Thread Fenton Travers
All fantastic comments...I was thinking why didn't i use - instead of plus! I'll fix these up soon. On Sun, Jun 10, 2012 at 6:05 AM, Ulises wrote: > Additional to all the positive comments, I'd suggest you use an > operator which is not commutative, otherwise the differences between > -> and ->

fully type-hinted record still uses reflection!

2012-06-10 Thread Jim - FooBar();
Hi again (busy day eh?), well this doesn't make any sense either! Why is a record with type-hinted arguments still using reflection? I've got the following example record: -- (defrecord CheckersPiec

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Lars Nilsson
On Sun, Jun 10, 2012 at 1:04 PM, Jim - FooBar(); wrote: > Hi again (busy day eh?), > > well this doesn't make any sense either! Why is a record with  type-hinted > arguments still using reflection? > I've got the following example record: > -

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Lars Nilsson
On Sun, Jun 10, 2012 at 1:08 PM, Lars Nilsson wrote: > On Sun, Jun 10, 2012 at 1:04 PM, Jim - FooBar(); wrote: >> Hi again (busy day eh?), >> >> well this doesn't make any sense either! Why is a record with  type-hinted >> arguments still using reflection? >> I've got the following example record

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Jim - FooBar();
Thanks Lars but there is no difference...when i try to load my namespace I get this output: Clondie24.core=> (load-file "src/Clondie24/core.clj") #'Clondie24.core/-mainReflection warning, /home/sorted/clooJWorkspace/Clondie24/src/Clondie24/core.clj:104 - call to setLocation can't be resolved.

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Ben Smith-Mannschott
On Sun, Jun 10, 2012 at 7:04 PM, Jim - FooBar(); wrote: > Hi again (busy day eh?), > > well this doesn't make any sense either! Why is a record with  type-hinted > arguments still using reflection? > I've got the following example record: > -

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Jim - FooBar();
a.A moment of enlightment thank you so so much... so what you're saying is that there is no confusion as to what object (record) to call setLocation on. The confusion arises when trying to decide which one of the 2 methods to invoke (there are indeed 2 and I knew it from the s

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Jim - FooBar();
On 10/06/12 18:43, Ben Smith-Mannschott wrote: "can accept ints or doubles" How is the Clojure compiler to know wether to compile a call to Point.setLocation(double,double) or Point.setLocation(int,int)? I think you need to tell the compiler the types of (first np) and (second np), which means

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread David Nolen
You can cast to primitive int with (int ...) On Sun, Jun 10, 2012 at 1:53 PM, Jim - FooBar(); wrote: > On 10/06/12 18:43, Ben Smith-Mannschott wrote: > >> "can accept ints or doubles" >> >> How is the Clojure compiler to know wether to compile a call to >> Point.setLocation(double,**double) or Po

Re: Function minimizer a la fminunc

2012-06-10 Thread Jason Lewis
David - You aren't taking the Stanford/Coursera ML class by any chance, are you? I was just starting to look into porting some of that stuff over from Octave to Clojure. Jason Lewis On Sun, Jun 10, 2012 at 8:24 AM, Lachlan wrote: > maybe http://commons.apache.org/math/apidocs/index.html w

[ANN] clojure.java.jdbc 0.2.2

2012-06-10 Thread Sean Corfield
On its way to Maven Central! Change Log * Release 0.2.2 on 2012-06-10 - Handle Oracle unknown row count affected JDBC-33 - Handle jdbc: prefix in string db-specs JDBC-32 - Handle empty columns in make column unique (Juergen Hoetzel) JDBC-31 For more details: https://github.com/clojure/java

core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-10 Thread Jim - FooBar();
Hello everyone, I'm trying to decide if its worth writing the rules of chess/checkers using core.logic or go down the conventional road but unfortunately I'm inexperienced as far as core.logic goes. I mean I've played around for a bit but nothing serious. What I want is NOT AI or anything li

Re: Why isn't there a fold-right?

2012-06-10 Thread Yoshinori Kohyama
Hello Tassilo and All, Thank you for your comment. Yes, it is sorry that my 'fold-right' eat large stack. Using 'reverse' is good. But I think 'reverse' is a special case of 'fold-right'. (fold-right #(concat %2 (list %)) '() '(:a :b :c :d)) ; -> (:d :c :b :a) If clojure's implementation of rever

Re: Why isn't there a fold-right?

2012-06-10 Thread OGINO Masanori
Hello. 2012/6/11 Yoshinori Kohyama : > If clojure's implementation of reverse don't consume stack, how does it do? `reduce1` is a recursive function using `recur`, explicit tail recursion with optimization. So it doesn't. > The source of 'reverse' says it uses 'reduce1' and commented "Not lazy"

Re: Why isn't there a fold-right?

2012-06-10 Thread Yoshinori Kohyama
Hi O. Masanori and all, Thank you so much for your kindly explanation. Sure that 'fold-right' itself is strict as you say. But I think that various right-folded-type loops, which can be stopped middle of a list, can be lazy. The continuation, which should be calculated in the later steps, shoul

Re: Uniform exceptions – Clojure and ClojureScript?

2012-06-10 Thread Dave Sann
Has anyone made headway on this? Does anyone have good practice that they can share? Cheers Dave On Wednesday, 28 December 2011 08:52:00 UTC+11, Dave Sann wrote: > > I believe the capability to have a portable solution in specific cases is > in the pipeline > > https://github.com/clojure/clo

Re: Function minimizer a la fminunc

2012-06-10 Thread David Jacobs
I took it last year. I've started to build out a library, first slowly but now with a little more focus: github.com/davejacobs/ml. So far it's a lot of fun! I could definitely be interested in collaborating. (fminunc doesn't look like it would be impossible to port.) On Sunday, June 10, 2012 4:

Re: clj-pdf for declarative PDF generation (status update)

2012-06-10 Thread Baishampayan Ghose
On Sun, Jun 10, 2012 at 10:16 PM, Dmitri wrote: > The reason I'm using strings for values is to make it easier to work with > deserialized JSON. Currently I have it running as a service that our > internal applications send a JSON request and get a PDF document back. Internally you can call `name

Re: Doseq, map-style

2012-06-10 Thread David Jacobs
This is good stuff. I've certainly felt the same way about FP at some points--for me, Clojure really illuminates why people thought OO was such a good thing 15 years ago. Let me know if you write that blog post. On Saturday, June 9, 2012 7:47:47 PM UTC-7, Kurt Harriger wrote: > > > You could a

Re: Doseq, map-style

2012-06-10 Thread David Jacobs
I'm not really talking about semantics here, I'm saying that the semantic difference between the two methods (map and my hypothetical each) probably don't need to be reflected in the language syntax. To me, it feels weird that doseq *doesn't actually call the function you pass in for you*. Inst

Re: Why isn't there a fold-right?

2012-06-10 Thread Yoshinori Kohyama
Hi all. Sorry for mere my continued report. Instead of reversing operands, I tried accumulating operators and reversing and applying it when stopping. https://gist.github.com/2896939 It doesn't consume stack. (but heap...) Regards, Yoshinori Kohyama -- You received this message because you are

Re: Why isn't there a fold-right?

2012-06-10 Thread Tassilo Horn
Yoshinori Kohyama writes: Hi! > Sorry for mere my continued report. No apologies needed. It's very interesting. > Instead of reversing operands, I tried accumulating operators and > reversing and applying it when stopping. > https://gist.github.com/2896939 > It doesn't consume stack. (but hea