Re: Library to create/apply patches of clojure data

2014-11-13 Thread Robin Heggelund Hansen
If you look at the issues list, you'll see that I tried it already ;) kl. 06:51:14 UTC+1 fredag 14. november 2014 skrev Ruslan Prokopchuk følgende: > > May be this one will be helpful https://github.com/timothypratley/patchin > > четверг, 13 ноября 2014 г., 11:31:39 UTC+3 пользователь Robin Hegge

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
Changed name: https://github.com/rplevy/funcycle/blob/master/src/fun/cycle.clj On Fri, Nov 14, 2014 at 12:49 AM, Robert Levy wrote: > This is pretty trivial, but it is maybe sometimes more natural to express > something as a cycling pattern of function applications over some data than > as one c

Re: Library to create/apply patches of clojure data

2014-11-13 Thread Ruslan Prokopchuk
May be this one will be helpful https://github.com/timothypratley/patchin четверг, 13 ноября 2014 г., 11:31:39 UTC+3 пользователь Robin Heggelund Hansen написал: > > I'm in need of a library that is able to create a patch for some Clojure > datastructure, and apply it at a later time. This has t

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
This is pretty trivial, but it is maybe sometimes more natural to express something as a cycling pattern of function applications over some data than as one constant function. The typical way of expressing those cases involves twisting it around so that the data is rotated/alternated instead of wh

Re: [ANN] Release 0.29.1 of Counterclockwise

2014-11-13 Thread Laurent PETIT
Hello, Version 0.29.1 has been reported problematic after upgrading for some environments. The problem's root has been spotted. A fixed 0.29.2 will be released in a few hours. Sorry for the inconvenience. If you have already upgraded and are stuck with a non-working environment, please get in to

Re: Tortoise-hare algorithm

2014-11-13 Thread Patric Fornasier
Hi Zemin, I just started learning clojure and came across your post, as I was implementing Floyd's algorithm. Here's what I came up with. https://gist.github.com/patforna/2cf0ffb46a1c0b93084d I've got no idea, if this makes sense, so any feedback would be really appreciated. Cheers, pat On

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
I was just thinking about this some more. Here's a slightly less terrible idea: (defn rotate [coll] (rest (take (inc (count coll)) (cycle coll (defn reducycle [fns init coll] (let [fns-atom (atom fns) alt-op (fn [& args] (swap! fns-atom rotate)

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
sorry, make that (*reduce alt-op *(*range 1 10)*) On Thu, Nov 13, 2014 at 10:28 PM, Robert Levy wrote: > (let [op (atom +)] > (defn alt-op [a b] > ((swap! op #(if (= % +) - +)) a b))) > > (map alt-op (range 1 10)) > > On Thu, Nov 13, 2014 at 10:09 PM, Robert Levy wrote: > >> But for "app

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
(let [op (atom +)] (defn alt-op [a b] ((swap! op #(if (= % +) - +)) a b))) (map alt-op (range 1 10)) On Thu, Nov 13, 2014 at 10:09 PM, Robert Levy wrote: > But for "applyv" you could do this: > > (*reduce + *(*map *(*comp eval list*) (*cycle *[*+ -*]) (*range 1 10*))) > > On Thu, Nov 13,

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
But for "applyv" you could do this: (*reduce + *(*map *(*comp eval list*) (*cycle *[*+ -*]) (*range 1 10*))) On Thu, Nov 13, 2014 at 10:06 PM, Robert Levy wrote: > Is that any more elegant than Dave's (reduce + (map * (cycle [1 -1]) > (range 1 n))) though? I would say that's the best actually

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
Is that any more elegant than Dave's (reduce + (map * (cycle [1 -1]) (range 1 n))) though? I would say that's the best actually sensible answer proposed in this thread. On Thu, Nov 13, 2014 at 9:54 PM, Andy L wrote: > > > On Thu, Nov 13, 2014 at 7:23 PM, Robert Levy wrote: > >> You don't need

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Andy L
On Thu, Nov 13, 2014 at 7:23 PM, Robert Levy wrote: > You don't need this for numbers over 900 right? > > I see what you mean. But no, I just practice and try to capture patterns. So, going after your example I got following: (reduce + (map applyv (cycle [+ -]) (range 1 10))) where something li

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
You don't need this for numbers over 900 right? On Thu, Nov 13, 2014 at 9:19 PM, Robert Levy wrote: > (defmacro altsum [n] `(-> 0 ~@(map list (cycle [+ -]) (range 1 n > > On Thu, Nov 13, 2014 at 9:02 PM, Andy L wrote: > >> (reduce + (map * (mapcat (fn[_] [1 -1]) (repeat nil)) (range 1 n)))

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Robert Levy
(defmacro altsum [n] `(-> 0 ~@(map list (cycle [+ -]) (range 1 n On Thu, Nov 13, 2014 at 9:02 PM, Andy L wrote: > (reduce + (map * (mapcat (fn[_] [1 -1]) (repeat nil)) (range 1 n))) > > not the best pattern for this case, but possibly useful to generate > alternated values ... > > A. > > --

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Paul English
You could use (-1)^{i+1}, which would be a bit more mathy but it may not be efficient. (defn altsum [n] (->> (range 1 (inc n)) (map #(* % (Math/pow -1 (inc % (reduce +))) On Nov 13, 2014, at 6:31 PM, Andy L wrote: > Hi, > > All I was able to come up with was this > > (de

Clojure meetup in Rochester, NY?

2014-11-13 Thread Tom George
Hi everyone, I wonder if there are any people in the Rochester, NY area that are on this mailing list that would like to set up a meetup to talk about cool Clojure stuff. I did some digging and I see that RocLisp was a thing a couple years ago. Their twitter has been dead since 2012 and their

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Andy L
(reduce + (map * (mapcat (fn[_] [1 -1]) (repeat nil)) (range 1 n))) not the best pattern for this case, but possibly useful to generate alternated values ... A. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Andy L
On Thu, Nov 13, 2014 at 6:36 PM, Dave Ray wrote: > How about: > > (->> (map * (cycle [1 -1]) (range 1 n)) > (reduce +)) > > Thx - I did not know cycle before. I think this is it, although I prefer nesting over threading. This is another I was thinking about: -- You received this message b

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Dave Ray
How about: (->> (map * (cycle [1 -1]) (range 1 n)) (reduce +)) ? Dave On Thu, Nov 13, 2014 at 5:31 PM, Andy L wrote: > Hi, > > All I was able to come up with was this > > (defn altsum[n] (reduce + (map * (range 1 (inc n)) (interpose -1 (repeat > 1) > > ... works quite well, however

[Job] Fulltime Software Engineer opportunity in Redwood City, CA

2014-11-13 Thread Grant Du Plooy
Yummly, a growing startup in the food tech revolution, has an exciting opportunity for a Software Engineer (Clojure) to work on various components of Yummly's service-oriented system that powers our website and mobile apps. Yummly's iOS app is already the #1 recipe app, and our site receives 1

a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Andy L
Hi, All I was able to come up with was this (defn altsum[n] (reduce + (map * (range 1 (inc n)) (interpose -1 (repeat 1) ... works quite well, however I was wondering if there is more idiomatic way to write that. Thanks, Andy -- You received this message because you are subscribed to the

Re: Showing pretty forms with their result?

2014-11-13 Thread Sébastien Bocq
I found an answer to my question, see below. Suggestions for improvements are welcome! (defn showeval [form] (let [[f & args] form] (str (clojure.string/trim-newline (with-out-str (clojure.pprint/pprint (map #(if (list? %1) `'~%1 %1) form " => " (

Re: Odd bug, apparently in ring.middleware or clojure.core.memoize?

2014-11-13 Thread James Reeves
The problem is that your dependency tree pulls in core.memoize 0.5.3, but other libraries have a dependency on 0.5.6. If you run "lein deps :tree" you can see this for yourself: [clj-jgit "0.8.1"] -> [org.clojure/core.memoize "0.5.3"] overrides [lib-noir "0.9.4"] -> [ring-middleware-f

Re: Announcing Smeagol, a very simple wiki engine inspired by Gollum

2014-11-13 Thread Simon Brooke
And... while it still works on my development machine, there's a bug if you check it out from gihub and try to build it. It fails with # I know about this issue and am trying to fix it, but so far no joy. Any help or advice most welcome! On Tuesday, 11 November 2014 21:55:00 UTC, Simon Brooke

Odd bug, apparently in ring.middleware or clojure.core.memoize?

2014-11-13 Thread Simon Brooke
Hi everyone Yesterday I proudly announced my new Wiki engine; today I'm investigating an odd bug which prevents it compiling on some Ubuntu machines, but not my laptop (on which I did the development), and I'm really puzzled by it. Top level outline: When one clones the repository from https:

[ANN] Cryogen - Static Site Generator

2014-11-13 Thread Carmen La
Check out my first project! As the title says, it's a static site generator :) Blog post: http://carmenla.me/blog/posts/12-11-2014-post1.html Github repo: https://github.com/lacarmen/cryogen Any feedback is appreciated :) -- You received this message because you are subscribed to the Google Gr

Re: [ANN] Counterclockwise User Plugins reloaded

2014-11-13 Thread Laurent PETIT
Hi again, I've published the 'Hello World' of User Plugins project: https://github.com/laurentpetit/ccw-plugin-hello-world The README describes how to install it, and how to live code it. Cheers, -- Laurent 2014-11-13 17:34 GMT+01:00 Laurent PETIT : > Since there has been interest in writin

Re: What does .NET open sourcing mean for ClojureCLR?

2014-11-13 Thread dmiller
The slower startup time has nothing to do with DLR, I think. It is all about doing JIT on load and loading full assemblies. ClojureCLR starts VERY quickly if you NGEN it. This was addressed here:http://clojureclr.blogspot.com/2011/12/using-ngen-to-improve-clojureclr.html And more recently on

Re: Hierarchical data core.logic

2014-11-13 Thread David Nolen
Ah sorry I miss read. Not currently supported, it's a requested feature from Prolog that I haven't gotten around to implementing. David On Thu, Nov 13, 2014 at 12:53 PM, Daniel Stone wrote: > I'm not sure I fully understand, I guess I'm looking for the equivalent to a > sub query? When I tried t

Re: Hierarchical data core.logic

2014-11-13 Thread Daniel Stone
I'm not sure I fully understand, I guess I'm looking for the equivalent to a sub query? When I tried to implement this early, I naively perhaps tried something like this: (defn bars-for-foo [?foo ?bars] (l/== ?bars (l/run* [?q] (fooz ?foo ?q This seems relevant: http://dev.cloju

Re: Hierarchical data core.logic

2014-11-13 Thread David Nolen
There's no need to define the reverse relation - fooz can do it. Just supply bar and leave the foo fresh. David On Thu, Nov 13, 2014 at 12:26 PM, wrote: > I think this is a dummy question, but wondering whether this is possible in > core.logic? > > Lets say I have a set of relations > > (db-rel

Hierarchical data core.logic

2014-11-13 Thread dan . stone16321
I think this is a dummy question, but wondering whether this is possible in core.logic? Lets say I have a set of relations (db-rel foo p) (db-rel bar p) (db-rel fooz p p2) and facts [foo 1] [bar 2] [fooz 2 1] [bar 3] [fooz 3 1] See that the fooz relation is potentially describing bar as chil

[ANN] Counterclockwise User Plugins reloaded

2014-11-13 Thread Laurent PETIT
Since there has been interest in writing User Plugins this last month, I've decided to be more serious about it. *Counterclockwise User Plugins allow you to customize Counterclockwise / Eclipse with Clojure!!* *User Plugins are...* - *Safe*: plug / unplug user plugins by adding / deleting repos

[ANN] Release 0.29.1 of Counterclockwise

2014-11-13 Thread Laurent PETIT
Counterclockwise, the Eclipse Clojure development tool. Counterclockwise 0.29.1 has been released. Fixes bugs of the 0.29.0 version. ChangeLog = http://doc.ccw-ide.org/ChangeLog.html#_changes_between_counterclockwise_0_29_0_and_0_29_1 Installation instructions == http

Showing pretty forms with their result?

2014-11-13 Thread Sébastien Bocq
Hi, I would like to display the results of applying first, next, rest to different collections. In the end, I'd like to create an org table with the forms and their result. I began simply with this: (doseq [op '(first next rest)] (doseq [cs '((nil) ('() '(1 2 3))

Re: Assuming too much in docs

2014-11-13 Thread Laurent PETIT
Hi Don, great demonstration of assumptions bias, you considering that there is certainly some guy named Rich that will read your message on this list ;-) I'm the WTFer of the current state of the Counterclockwise documentation. I tried to enhance it so that Leiningen is better introduced. The re

Library to create/apply patches of clojure data

2014-11-13 Thread Robin Heggelund Hansen
I'm in need of a library that is able to create a patch for some Clojure datastructure, and apply it at a later time. This has to work in both Clojure and Clojurescript. The use case is that I'm autosaving a datastructure (through repeatedly doing ajax calls, could be done over websocket) that

Re: test.check slow shrinking

2014-11-13 Thread Lucas Bradstreet
My thought process with that suggestion is that a shrink of the matrix elements (not the size), will not require the samples and probes to be regenerated. At some point I'll probably have to look into how the shrinking works. > On 13 Nov 2014, at 06:18, Brian Craft wrote: > > I tried your idea