Re: Running a clojure script

2012-12-16 Thread Marko Topolnik
On Sunday, December 16, 2012 5:12:36 AM UTC+1, Armando Blancas wrote: Why are you using puzzler's account and what did you did to him?! And who, in your opinion, is puzzler, if not Mark Engelberg? -- You received this message because you are subscribed to the Google Groups Clojure group.

Re: Confused about comp

2012-12-16 Thread Peter West
Thanks again. I do get it. I'm not saying that apply has effects other than the result it returns. No, it's not a side-effect; it doesn't change something in the environment in passing. What it changes is the expected result, if you expect that, as Rich Hickey is supposed to have written,

Re: another n00b defrecord combination question

2012-12-16 Thread mond
Great stuff Ben. Thanks. ray On Saturday, December 15, 2012 10:54:42 PM UTC+1, Benjamin R. Haskell wrote: On Sat, 15 Dec 2012, mond wrote: Thanks for picking up the cudgels Ben! Ha. It's nice to have reached a point where I feel at-all confident with any of this... happy to help.

Re: Confused about comp

2012-12-16 Thread Marko Topolnik
Users of clojure learn that pretty quickly. I've just learned it. Doc doesn't help. user= (doc apply) - clojure.core/apply ([f args] [f x args] [f x y args] [f x y z args] [f a b c d args]) Applies fn f to the argument list formed by prepending

Re: Confused about comp

2012-12-16 Thread Marko Topolnik
If you are looking, for some reason I can't imagine at the moment, for a function that acts just like a funcall, so that (funcall f [i]) is exactly equivalent to (f [i]), I guess you are out of luck. I can give you a reason: applying a curried function. On first sight that may seem like

Re: JavaFX and Clojure

2012-12-16 Thread Christian Sperandio
I did some changes. First and foremost, I change the project's name to a more formal one: it has became clj-javafx and the link is now https://github.com/chrix75/clj-javafx I cleaned the code too, thus: - I remove the ugly Thread/sleep for promise and deliver - make the code cleaner

Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread jarppe
Hi, I have this macro (complete file https://www.refheap.com/paste/7633): *(*defmacro defgreeter [greeter-name] *(*let [greeter *(*make-greeter*)*] `*(*do *(*defn ~greeter-name [user-name#] *(*~greeter user-name#*)**)**)**)**)* It works as expected when make-greeter

Re: ANN: lein-clr 0.2.0 for ClojureCLR

2012-12-16 Thread Shantanu Kumar
Hi Aaron, On Sunday, 16 December 2012 04:45:16 UTC+5:30, Aaron wrote: Cool. I'm just seeing this now. I actually spent some time a while back getting a very simple nleiningen working in ClojureCLR. I had nuget downloads working and also the ability to AOT compile namespaces and merge

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread juan.facorro
I think it has to do with the closure in the *fn *used when generating the form in the macro. If you change this function: *(defn make-greeter []* * (let [message hello]* *(fn [user-name]* * (str message , user-name* To this one: *(defn make-greeter [] * * (fn [user-name]* *

Re: Confused about comp

2012-12-16 Thread Marko Topolnik
As for your suggestion of a (funcall f [i]) that behaves just like (f [i]), I can't imagine any possible purpose for that in Clojure. Why would you not just write (f [i])? Well, why don't you start with my example? Try rewriting this without OP's * apply*, implemented here as #(%1 %2).

Re: Running a clojure script

2012-12-16 Thread Armando Blancas
I'm not going out of my way to be pseudonymous, it just seems to be a feature of the group. I thought, Mark asking how to run a script? An usurper! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Running a clojure script

2012-12-16 Thread Mark Engelberg
On Sun, Dec 16, 2012 at 10:06 AM, Armando Blancas abm221...@gmail.comwrote: I'm not going out of my way to be pseudonymous, it just seems to be a feature of the group. I thought, Mark asking how to run a script? An usurper! Ah yes. My understanding of Clojure runs fairly deep, but

Re: Confused about comp

2012-12-16 Thread Mark Engelberg
On Sun, Dec 16, 2012 at 10:04 AM, Marko Topolnik marko.topol...@gmail.comwrote: Well, why don't you start with my example? Try rewriting this without OP's *apply*, implemented here as #(%1 %2). (defn apply-curried [f args] (reduce #(%1 %2) f args)) To avoid confusion, I'm going to refer

Using functions from Java packages

2012-12-16 Thread Larry Travis
It almost certainly has something to do with my abysmal ignorance about things Java, but I don't understand this difference: (1) user (map Math/sqrt [5 6 16]) Unable to find static field: sqrt in class java.lang.Math [Thrown class java.lang.RuntimeException] (2) user (map #(Math/sqrt

Re: Confused about comp

2012-12-16 Thread Marko Topolnik
However, the fact that you can write funcall so easily as #(%1 %2) illustrates that funcall adds no real expressiveness to the language, whereas apply is really fundamental to being able to pass lists to multi-arg functions. It's hard to imagine how to write apply at all if it weren't

Re: Using functions from Java packages

2012-12-16 Thread Jim - FooBar();
Java methods are not first-class...you cannot use them like that...you need an object to call the method on...by wrapping the java call with an anonymous fn you are able to use Math/sqrt as 1st-class... Hope it is clearer now... Jim On 16/12/12 19:33, Larry Travis wrote: It almost certainly

Re: Using functions from Java packages

2012-12-16 Thread Softaddicts
First example tries to access a public static field in the Math class. Second example calls the static member function of the Math class. The difference is in the missing set of parenthesis. A static field or member function is attached to the class, not to a specific object and can be

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread Jonathan Fischer Friberg
I don't know why it doesn't work. However, changing defgreeter to the following seems work. (defmacro defgreeter [greeter-name] (let [greeter (make-greeter)] `(def ~greeter-name ~greeter))) Might be a clue. :) Jonathan On Sun, Dec 16, 2012 at 6:49 PM, juan.facorro

Re: How to structure a Clojure day for noobs?

2012-12-16 Thread ulsa
Good points, thanks. It's so easy to overload them, because one wants to teach them every little piece of gold that's in there. I think it was in one of the old XP books, where there was this graph that showed which practices were supported by or enabled other practices. I would love to see

Re: How to structure a Clojure day for noobs?

2012-12-16 Thread Marko Topolnik
My plan was to do something like this: *First half of the day* 1. install Leiningen and learn the basics 2. get everyone an editing environment, with the option of using either Emacs, IntelliJ, or Eclipse 3. teach the basics and let everyone follow along in their own environment

Re: another n00b defrecord combination question

2012-12-16 Thread mond
One small thing Ben... when I try to use the final formulation I receive an error: (def joined-products (map product-with-item products)) user= (joined-products) ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn user/eval241 (NO_SOURCE_FILE:9) Any ideas? Thanks in

Re: another n00b defrecord combination question

2012-12-16 Thread Benjamin R. Haskell
On Sun, 16 Dec 2012, mond wrote: One small thing Ben... when I try to use the final formulation I receive an error: (def joined-products (map product-with-item products)) user= (joined-products) ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn   user/eval241

Re: another n00b defrecord combination question

2012-12-16 Thread Ray
Hilarious - I am so conditioned already to have everything in a list :) Thanks for your patient explanation. Merry xmas. ray Ray On Sunday 16 December 2012 at 22:20, Benjamin R. Haskell wrote: On Sun, 16 Dec 2012, mond wrote: One small thing Ben... when I try to use the final

Re: abysmal multicore performance, especially on AMD processors

2012-12-16 Thread Lee Spector
On Dec 15, 2012, at 1:14 AM, cameron wrote: Originally I was using ECJ (http://cs.gmu.edu/~eclab/projects/ecj/) in java for my GP work but for the last few years it's been GEVA with a clojure wrapper I wrote (https://github.com/cdorrat/geva-clj). Ah yes -- I've actually downloaded and

Re: abysmal multicore performance, especially on AMD processors

2012-12-16 Thread Lee Spector
On Dec 14, 2012, at 10:41 PM, cameron wrote: Until Lee has a representative benchmark for his application it's difficult to tell if he's experiencing the same problem but there would seem to be a case for changing the PersistentList implementation in clojure.lang. We put together a

Re: How to structure a Clojure day for noobs?

2012-12-16 Thread Devin Walters
I think showing people how metadata works usually makes people start dreaming, and exposes them to docstrings and arglists which I think is crucial to self-directed learning. So, I think I'd show them: (doc ...), and then show how that is metadata, and for quicker folks you could show how to

Re: How to structure a Clojure day for noobs?

2012-12-16 Thread ulsa
Thanks, I won't forget the REPL. I think, however, that there is a risk of a disconnect, where newcomers don't really grasp that there is a JVM running and that code is actually compiled and injected into it, and that it's for real. They are used to mickey mouse interactive tools that don't

Re: How to structure a Clojure day for noobs?

2012-12-16 Thread ulsa
Interesting idea. Let me ponder that. When one starts pulling on a thread like metadata for example, all kinds of interesting facets pop up. That's what I meant with my comment about the XP practices graph thing. Different Clojure capabilities support and enable other capabilities, and you

The idiomatic use of keyword arguments

2012-12-16 Thread Michael Hanson
I remember in Rich Hickey's talk Simplicity Matters, he mentioned that forcing the user to remember the order of function arguments, as opposed to using keyword arguments, is overly-complex; yet, reading Clojure source code and looking at the standard functions, I find that keyword arguments

Re: The idiomatic use of keyword arguments

2012-12-16 Thread Moritz Ulrich
I think one of the main reasons we don't use keyword arguments everywhere is their verbosity. Most function names implicate the order of arguments, and many functions don't take more than two or three. It's a trade-off between how much a programmer has to remember and how much he has to code.

Re: The idiomatic use of keyword arguments

2012-12-16 Thread Softaddicts
I would say that above 4 args, it starts to exercise your memory except if you have auto-completion and a tool tip provided by your IDE. Optional arguments are better handled with keywords than with an option map or multiple signatures. This the area were you can get lost. At least with keyword

Re: Using functions from Java packages

2012-12-16 Thread Larry Travis
Thank you, gentlemen. Jim and Luc, your answers are both helpful. Luc's answer illustrates why a Java tyro often has problems understanding Clojure. Somebody like me who is trying to master Clojure, having come to it via a language path that doesn't include Java, needs a prerequisite crash

Re: Using functions from Java packages

2012-12-16 Thread Softaddicts
The problem if you dive into Java is that it may bring to your attention a myriad of details that may not be worth the trouble of learning if you do not expect to dive into Java and stay on the Clojure side of the fence. No ready-fit light reading comes to my mind. Maybe a learn java in 21 days

Re: another n00b defrecord combination question

2012-12-16 Thread Leif
Hi, Ray. When you are doing things that have a relational algebra feel to them (joins, etc.), you might want to consider the fns in the clojure.set namespace. E.g.: ;; convert vectors of records to sets, then: (clojure.set/join (clojure.set/rename items {:id :iid :name :iname}) ; to

Re: Clojure syntax coloring for wordpress blogs

2012-12-16 Thread Nick Gonzalez
When I move it off of wordpress I will use highlight.js. Unfortunately I'm using a free hosted wordpress.com site and can't install plugins. So it looks like I'm out of luck for now. If I end up keeping this blog up, I'll pay the couple of bucks and move it to a real host and setup the

[ANN] lein-cljsbuild 0.2.10

2012-12-16 Thread Evan Mezeske
Hello, After a very long three weeks without a home internet connection, I've finally gotten around to releasing version 0.2.10 of lein-cljsbuild. Thank you all for your patience, I know that there hasn't been a release in a while! This release will default to using the upstream

Expression Evaluation

2012-12-16 Thread Paul Sholtz
I was messing around with the Clojure interpreter and typed this: user= ('+ 3 4) The interpreter responded with 4. That's odd (but interesting).. Clearly if I had typed (+ 3 4), it would have responded with 7, and it I had typed '(3 4), it would have responded with a list (3 4), but why does

Re: Expression Evaluation

2012-12-16 Thread Ambrose Bonnaire-Sergeant
Symbols are functions. See http://clojure.org/data_structures#Data%20Structures-Symbols Thanks, Ambrose On Mon, Dec 17, 2012 at 12:12 PM, Paul Sholtz paul.sho...@gmail.com wrote: I was messing around with the Clojure interpreter and typed this: user= ('+ 3 4) The interpreter responded with

Re: Who's using Clojure?

2012-12-16 Thread Simon Holgate
London Clojurians has a periodic update of who's using Clojure in production. The latest thread is here: https://groups.google.com/forum/?fromgroups#!topic/london-clojurians/ES8AuxXI0Nk There are a few here that haven't been mentioned elsewhere such as Likely.co, MastodonC, uSwitch,

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread jarppe
I think you are right, when ever the function returns a closure I get the exception. I think it should work with closures anyhow. -- -jarppe On Sunday, December 16, 2012 7:49:30 PM UTC+2, juan.facorro wrote: I think it has to do with the closure in the *fn *used when generating the form