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

2012-06-11 Thread Tassilo Horn
Yoshinori Kohyama yykohy...@gmail.com 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

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

2012-06-11 Thread Yoshinori Kohyama
Hello Tassilo and all again, Thank you for your kind words to me and useful consideration. However, you have to reverse the list of functions, which destroys the theoretical benefit. Exactly! But still my reverse-the-collection-and-then-reduce-it approach is still much faster,

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

2012-06-11 Thread Tassilo Horn
Yoshinori Kohyama yykohy...@gmail.com writes: But still my reverse-the-collection-and-then-reduce-it approach is still much faster, although it has to iterate the collection twice. It seems to make things faster using a '(transient [])'. Thank you. The main difference is that I build up a

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

2012-06-11 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 11. Juni 2012 10:04:59 UTC+2 schrieb Tassilo Horn: The main difference is that I build up a new vector of functions instead of a list of functions in order not to have to reverse it. You should probably inline comp for your purposes. Note the reverse call there.

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

2012-06-11 Thread Yoshinori Kohyama
Hi Meikel, Thank you for pointing it out that 'comp' calls 'reverse' internally. I've been calling 'reverse' twice. Appreciate you so much. I'll try 'comp'ing the accumulated functions manually without 'reverse'. Regards, Yoshinori Kohyama -- You received this message because you are

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

2012-06-11 Thread Tassilo Horn
Meikel Brandmeyer (kotarak) m...@kotka.de writes: The main difference is that I build up a new vector of functions instead of a list of functions in order not to have to reverse it. You should probably inline comp for your purposes. Note the reverse call there.

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

2012-06-11 Thread Tassilo Horn
Tassilo Horn tass...@member.fsf.org writes: You should probably inline comp for your purposes. Note the reverse call there. https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L2267 Oh, that's a pity. I'd much vote for a left-to-right

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

2012-06-11 Thread Jim - FooBar();
I managed to find this piece of prolog code in http://bkraabel.free.fr/pages/kmoves_pl.html#top of page http://bkraabel.free.fr/pages/kmoves_pl.html#top%20of%20page but I don't know how to read it! Can anyone help me translate that to core.logic so i have a starting point? checkers also move

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

2012-06-11 Thread Jim - FooBar();
sorry I confused knights with bishops! I meant to say that checkers move similarly with bishops...nevertheless, If I can translate the knight's move (perhaps the most difficult one), I think I can come up with the moves for the rest of the pieces... Jim On 11/06/12 11:25, Jim - FooBar();

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

2012-06-11 Thread Tassilo Horn
Tassilo Horn tass...@member.fsf.org writes: You should probably inline comp for your purposes. Note the reverse call there. https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L2267 Oh, that's a pity. I'd much vote for a left-to-right

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

2012-06-11 Thread mnicky
Although I am familiar with Prolog, I'm not very familiar with core.logic yet :-( But maybe I can provide you an explanation of that Prolog code and you can derive the core.logic implementation by yourself... All clauses you provided define one predicate, move(), which has two arguments and

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

2012-06-11 Thread Yoshinori Kohyama
Hi Tassilo and all. I'm testing some code. It seems that the clojure runtime remembers some results of calculation. For an exact comparison, please do 1) Exec java clojure.main 2) Exec one version of a function 3) Quit java clojure.main 4) Exec java clojure.main 5) Exec another version of the

nrepl timeout advice needed

2012-06-11 Thread MikeM
I'm using nrepl with a client created as described in the github readme (https://github.com/clojure/tools.nrepl). The nrepl server and client are on the same machine. Everything's working well, except when I try to eval a long-running bit of code. It seems that the timeout defined for the client

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

2012-06-11 Thread Meikel Brandmeyer (kotarak)
Hi, I propose to use criterium to do benchmarking. https://clojars.org/criterium The restart of the JVM should not be necessary. You normally need just enough warm-up rounds. criterium (mostly) takes care of such details. Kind regards Meikel -- You received this message because you are

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

2012-06-11 Thread Dmitri Sotnikov
That's a good point, it would make the API more idiomatic I suppose. On 2012-06-11, at 01:45 , Baishampayan Ghose wrote: On Sun, Jun 10, 2012 at 10:16 PM, Dmitri dmitri.sotni...@gmail.com wrote: The reason I'm using strings for values is to make it easier to work with deserialized JSON.

Re: nrepl timeout advice needed

2012-06-11 Thread Chas Emerick
Providing a timeout of Long/MAX_VALUE is functionally equivalent to having no timeout. This is what most nREPL clients use by default (including reply [and therefore Leiningen], and the Java Connection class, which Counterclockwise uses). - Chas -- http://cemerick.com [Clojure Programming

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

2012-06-11 Thread Dmitri
And it's been updated as per suggestion, thanks for the tip. On 2012-06-11, at 01:45 , Baishampayan Ghose wrote: On Sun, Jun 10, 2012 at 10:16 PM, Dmitri dmitri.sotni...@gmail.com wrote: The reason I'm using strings for values is to make it easier to work with deserialized JSON.

[ANN] clj-webdriver 0.6.0-alpha9 released

2012-06-11 Thread semperos
I've just released version 0.6.0-alpha9 of clj-webdriver. Please see this post for more details: https://groups.google.com/forum/#!topic/clj-webdriver/B_QvWIOFr2o -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

ANN Monger 1.0 RC1: a Clojure MongoDB client for a more civilized age

2012-06-11 Thread Michael Klishin
Disclaimer: Monger is not a new project but it has reached 1.0 release candidates stage and it's time to properly announce it here. Monger [1] is a Clojure MongoDB driver for a more civilized age: with clean API, sane defaults, batteries included, documentation guides and good test coverage.

Re: ANN Monger 1.0 RC1: a Clojure MongoDB client for a more civilized age

2012-06-11 Thread Vinzent
Very impressive. Thank you! -- 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 unsubscribe from this

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

2012-06-11 Thread Jim - FooBar();
Thanks a million mnicky!!! A simple explanation like yours is just what I needed...I think i get the rationale... however, how would I know which of the 8 functions to call when the time comes to consume it? I can see 8 move predicates with identical signatures...how would i call them and

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

2012-06-11 Thread David Nolen
I don't have the time to work on this myself but I'd more than welcome a Translations from Prolog page on the core.logic GitHub wiki. David On Mon, Jun 11, 2012 at 11:31 AM, Jim - FooBar(); jimpil1...@gmail.comwrote: Thanks a million mnicky!!! A simple explanation like yours is just what I

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

2012-06-11 Thread Tassilo Horn
Meikel Brandmeyer (kotarak) m...@kotka.de writes: Hi Meikel, I propose to use criterium to do benchmarking. https://clojars.org/criterium Thanks for the hint. The short answer is that the creation of a function composition using `comp*` (see patch attached to CLJ-1010) is much, much faster

Central screwup

2012-06-11 Thread Phil Hagelberg
Some time over the weekend Maven Central lost knowledge of all versions of Clojure other than 1.2.0: $ curl http://repo.maven.apache.org/maven2/org/clojure/clojure/maven-metadata.xml ?xml version=1.0 encoding=UTF-8? metadata groupIdorg.clojure/groupId artifactIdclojure/artifactId

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

2012-06-11 Thread mnicky
On Monday, June 11, 2012 5:31:41 PM UTC+2, Jim foo.bar wrote: Thanks a million mnicky!!! A simple explanation like yours is just what I needed...I think i get the rationale... You are welcome :) however, how would I know which of the 8 functions to call when the time comes to

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

2012-06-11 Thread David Nolen
On Mon, Jun 11, 2012 at 12:30 PM, mnicky markus.mas...@gmail.com wrote: You can probably substitute the is operator of Prolog with the == operator of core.logic, but very likely you will have to define your own greather than and lower than operators... Marek. There is an arithmetic

Re: Central screwup

2012-06-11 Thread Phil Hagelberg
On Mon, Jun 11, 2012 at 9:28 AM, Phil Hagelberg p...@hagelb.org wrote: Some time over the weekend Maven Central lost knowledge of all versions of Clojure other than 1.2.0: I've deployed the other versions to Clojars as a temporary measure: https://clojars.org/org.clojure/clojure These

Re: Central screwup

2012-06-11 Thread mnicky
Seems like a manifest issue, because all versions are there: http://repo1.maven.org/maven2/org/clojure/clojure/ Marek. On Monday, June 11, 2012 6:28:42 PM UTC+2, Phil Hagelberg wrote: Some time over the weekend Maven Central lost knowledge of all versions of Clojure other than 1.2.0: $

Re: Clojure job scheduler

2012-06-11 Thread Joao_Salcedo
hi Trevor could you share how did you solve the issue. I would like to learn more about it. If you can share your solution would be great On Saturday, January 8, 2011 4:13:17 AM UTC+11, Trevor wrote: What's the best way to kick off Clojure code at scheduled times? I have some that would run

Clojure Sticker

2012-06-11 Thread aboy021
Is there anywhere that I can get a Clojure sticker? -- 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.

Problem with defmacro

2012-06-11 Thread Christian Packenius
Hi, the following code is an example from a Clojure book. It defines a macro named vmap that can work like map but with changed parameters: (defmacro vmap [coll f] '(map ~f ~coll)) Now I try to use it: (vmap [1 2 3] inc) #CompilerException java.lang.Exception: Unable to resolve symbol: f in

Re: Explaining the thrush - operator.

2012-06-11 Thread Lucas Marinho
Very nice! One little problem I had while learning this operator was realizing that it was a macro and not simply a form of function composition (like an inverted 'comp'). So to convert something like ((comp #(+ % 1) #(+ % 2)) 0) to use thrush you would need to write (- 0 (+ 2) (+ 1)) and

Problems resolving dependencies due to maven central repo fail

2012-06-11 Thread Craig Brozefsky
Several people have run into issues trying to run 'lein deps' or otherwise resolve their maven dependencies. This is apparently due to a change that occured on the maven central repo sometime in the last 24 hours. See Article A below for the before, an Article B for the after. This effectively

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread tomoj
This workaround doesn't work if the super-namespace doesn't exist. For example, goog.async is never provided, but goog.async.Deferred is provided (in the third-party bits of closure) and is itself the Deferred constructor. (:require [goog.ui :as ui]) similarly throws an error for me. Any

Re: Is still idiomatic the ant simulation code?

2012-06-11 Thread Alexey Kachayev
Guys, can you please share link where I can find the ants demo code? -- Alexey Kachayev, CTO at KitApp, Inc. On Friday, June 8, 2012 at 4:44 PM, Stuart Sierra wrote: The ants demo is definitely dated. It's not terrible, but the code could use some polishing/simplifying using newer

Re: Problem with defmacro

2012-06-11 Thread Jack Moffitt
(defmacro vmap [coll f] '(map ~f ~coll)) This needs to be backtick, not single quote. (defmacro vmap [coll f] `(map ~f ~coll)) jack. -- 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

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread David Nolen
This is an known existing issue. Using :require to important constructors just doesn't make sense. 2 patches I think could help here: 1) support for :import 2) support for :require w/o :as Anyone game to submit some fixes? David On Thu, Jul 28, 2011 at 10:41 AM, Marko Kocić

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread tomoj
I noticed that it works fine to just do (:require [goog.async.Deferred :as d]) and to use (goog.async.Deferred.) to call the constructor (in this case Deferred is also used as a namespace, so require makes sense). With :require w/o :as support, you'd have (:require goog.async.Deferred) ...

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread David Nolen
On Mon, Jun 11, 2012 at 1:37 PM, tomoj t...@tomoj.la wrote: I noticed that it works fine to just do (:require [goog.async.Deferred :as d]) and to use (goog.async.Deferred.) to call the constructor (in this case Deferred is also used as a namespace, so require makes sense). With :require w/o

Re: Explaining the thrush - operator.

2012-06-11 Thread Jacek Laskowski
On Sat, Jun 9, 2012 at 11:41 AM, Lucas Marinho lmari...@gmail.com wrote: ((comp #(+ % 1) #(+ % 2)) 0) I couldn't resist. #(+ % 1) == inc #(+ % 2) == (partial + 2) They give much better-looking functional program. Hope you forgive me :-) Jacek -- Jacek Laskowski Functional languages

Re: Is still idiomatic the ant simulation code?

2012-06-11 Thread Curtis Gagliardi
Here's the video: http://blip.tv/clojure/clojure-concurrency-819147 and you can get the code here (ants.clj): http://www.lisptoronto.org/past-meetings/2009-05-clojure-ants-demo or here if you don't want to download it: https://www.refheap.com/paste/3096 On Jun 10, 8:00 am, Alexey Kachayev

Leiningen2 + lein-midje + lazytest question

2012-06-11 Thread Cédric Pineau
I just manage to get the lazytest facility of lein-midje I used with lein1 back with lein2 : (defproject hands-on 0.1.0-SNAPSHOT :repositories {stuart http://stuartsierra.com/maven2} :dependencies [[org.clojure/clojure 1.4.0] [midje 1.4.0]

Re: Leiningen2 + lein-midje + lazytest question

2012-06-11 Thread Phil Hagelberg
On Mon, Jun 11, 2012 at 12:52 PM, Cédric Pineau cedric.pin...@gmail.com wrote: My question is with the lazy-test dependency. Do I really have to put it as a project dependency ? It doesn't seem to be on the lein-midje path when puting it in the dev-dependencies.. If it's required for

Re: Central screwup

2012-06-11 Thread Phil Hagelberg
On Mon, Jun 11, 2012 at 9:36 AM, Phil Hagelberg p...@hagelb.org wrote: These will be removed once Central gets back to working order, but they should help stem the flow of catastrophic build failures. While this will allow most builds to work, it's a band-aid solution. Is there anyone on the

Re: Clojure Sticker

2012-06-11 Thread Christian Guimaraes
I'm interested also... On Sun, Jun 10, 2012 at 2:03 AM, aboy021 arthur.bo...@gmail.com wrote: Is there anywhere that I can get a Clojure sticker? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Clojure Sticker

2012-06-11 Thread Joseph Smith
Me too! --- Joseph Smith j...@uwcreations.com @solussd On Jun 11, 2012, at 2:08 PM, Christian Guimaraes cguimaraes...@gmail.com wrote: I'm interested also... On Sun, Jun 10, 2012 at 2:03 AM, aboy021 arthur.bo...@gmail.com wrote: Is there anywhere that I can get a Clojure sticker? --

Re: Clojure Sticker

2012-06-11 Thread Sven Johansson
I've been trawling the internet for Clojure stickers before and come up empty. If there's really and truly nowhere to get these online, I'll have it done before the end of the week and put it up for order via whatever international order t-shirt/paraphernalia online-shop that seems to work best.

Re: Clojure Sticker

2012-06-11 Thread Jim.foobar
i got a t-shit from zazzle ... Sent from my mobile... Sven Johansson johansson.s...@gmail.com wrote: I've been trawling the internet for Clojure stickers before and  come up empty. If there's really and truly nowhere to get these  online, I'll have it done before the end of the week and put it

Re: Clojure Sticker

2012-06-11 Thread Jim - FooBar();
Obviously, I meant t-shirt... :-[ Jim On 12/06/12 00:29, Jim.foobar wrote: i got a t-shit from zazzle ... Sent from my mobile... Sven Johansson johansson.s...@gmail.com wrote: I've been trawling the internet for Clojure stickers before and come up empty. If there's really and truly

Re: Explaining the thrush - operator.

2012-06-11 Thread Frank Siebenlist
Just nitpicking, but for me those thread-first/last operators beg for proper formatting with newlines and indentation to emphasize the threading, like not: (- 2 (* 5) (+ 3)) but: (- 2 (* 5) (+ 3)) also as mentioned before, using thread-first and thread-last to name those

scanLeft

2012-06-11 Thread Andy Coolware
Hi, I am looking for a way to express following function in Clojure: scala scanLeft(List(1,2,3))(0)(_ + _) res1: List[Int] = List(0, 1, 3, 6) Any insight? Andy ... -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: scanLeft

2012-06-11 Thread Dave Ray
Try reductions: user= (reductions + 0 [1 2 3]) (0 1 3 6) Dave On Mon, Jun 11, 2012 at 5:51 PM, Andy Coolware andy.coolw...@gmail.com wrote: Hi, I am looking for a way to express following function in Clojure: scala scanLeft(List(1,2,3))(0)(_ + _) res1: List[Int] = List(0, 1, 3, 6)

Re: scanLeft

2012-06-11 Thread Evan Mezeske
I think this does what you want: clj (reductions + 0 [1 2 3]) (0 1 3 6) On Monday, June 11, 2012 5:51:15 PM UTC-7, Andy C wrote: Hi, I am looking for a way to express following function in Clojure: scala scanLeft(List(1,2,3))(0)(_ + _) res1: List[Int] = List(0, 1, 3, 6) Any insight?

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread Michał Marczyk
On 11 June 2012 18:49, David Nolen dnolen.li...@gmail.com wrote: Anyone game to submit some fixes? I am. I'll create a new ticket for :import and build :require w/o :as on top of that (attaching patch to CLJS-272). M. -- You received this message because you are subscribed to the Google

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread Michał Marczyk
See http://dev.clojure.org/jira/browse/CLJS-312 for :import (patch attached). Looking at 272 now... On 12 June 2012 03:16, Michał Marczyk michal.marc...@gmail.com wrote: On 11 June 2012 18:49, David Nolen dnolen.li...@gmail.com wrote: Anyone game to submit some fixes? I am. I'll create a

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread David Nolen
Thanks! On Mon, Jun 11, 2012 at 9:22 PM, Michał Marczyk michal.marc...@gmail.comwrote: See http://dev.clojure.org/jira/browse/CLJS-312 for :import (patch attached). Looking at 272 now... On 12 June 2012 03:16, Michał Marczyk michal.marc...@gmail.com wrote: On 11 June 2012 18:49, David

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread Michał Marczyk
Patch attached to 272 (note it's created on top of 312). Cheers, M. On 12 June 2012 03:22, David Nolen dnolen.li...@gmail.com wrote: Thanks! On Mon, Jun 11, 2012 at 9:22 PM, Michał Marczyk michal.marc...@gmail.com wrote: See http://dev.clojure.org/jira/browse/CLJS-312 for :import

Re: Clojure job scheduler

2012-06-11 Thread Sun Ning
By the way, overtone has made a simple library for scheduled task. You may take a look: https://github.com/overtone/at-at On Mon 11 Jun 2012 04:31:41 PM CST, Joao_Salcedo wrote: hi Trevor could you share how did you solve the issue. I would like to learn more about it. If you can share your

Re: Clojure Sticker

2012-06-11 Thread Michał Marczyk
Turns out there is -- at a Clojure conference. I got a very pretty one at EuroClojure. :-) Cheers, M. On 10 June 2012 03:03, aboy021 arthur.bo...@gmail.com wrote: Is there anywhere that I can get a Clojure sticker? -- You received this message because you are subscribed to the Google

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

2012-06-11 Thread Yoshinori Kohyama
Hi all, To fold operations from right to left, accumulate what calculations should be done in a list with *cons* in order (Thanks Tassilo) and *comp*ose accumulated functions manually (Thanks Meikel, almost equivalent to using Tassilo's *comp** I think) without reverse. First, the initial

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

2012-06-11 Thread Yoshinori Kohyama
Hi all, I'm sorry such my frequent posts. How stupid have I been! The function 'f' doesn't vary in the chain of operations. We only have to keep 1st operands of 'f' in reversed order in a list. What I have to do is applying 'f' in the reversing order when stopping condition comes, instead of

Re: scanLeft

2012-06-11 Thread Andy Coolware
thx, I see it now. -- 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 unsubscribe from this group,

Re: Is still idiomatic the ant simulation code?

2012-06-11 Thread Baishampayan Ghose
Can you elaborate some suggestions? I have updated the Ants sim code to use the idiomatic JVM inter-op constructs and made some other minor changes. Will work fine on Clojure 1.4 Here is the updated code - https://www.refheap.com/paste/3099 This is the unified diff -