comp and partial vs ->>

2016-10-27 Thread JHacks
I have some confusion about how the function `comp` works, especially as compared to the threading macro `->>`. >From the book *Clojure Programming* (pages 70-71 of Chapter 2: Functional Programming), the following two functions are described as functionally equivalent: (def camel->keyword

Re: comp and partial vs ->>

2016-10-27 Thread lvh
Hi, > On Oct 27, 2016, at 9:54 AM, JHacks wrote: > > I have some confusion about how the function `comp` works, especially as > compared to the threading macro `->>`. > > From the book *Clojure Programming* (pages 70-71 of Chapter 2: Functional > Programming), the following two functions are de

Re: comp and partial vs ->>

2016-10-27 Thread Gary Trakhman
Comp does its work at run-time, so you have to call functions that return functions. Threading macros do their work at compile-time, so your form literally compiles to this: > (clojure.walk/macroexpand-all '(->> (str/split s #"(?<=[a-z])(?=[A-Z])") (map str/lower-case) (int

Re: comp and partial vs ->>

2016-10-27 Thread Alan Thompson
I almost never use either the `comp` or the `partial` functions. I think it is clearer to either compose the functions like Gary showed, or to use a threading macro (my favorite is the `it->` macro from the Tupelo library ). Alan On Thu

Re: comp and partial vs ->>

2016-10-27 Thread Anon Mouse
as-> is an alternative to using Tupelo's it-> as-> allows you to use a contextually meaningful identifier vs using 'it. On Thursday, October 27, 2016 at 12:39:27 PM UTC-4, Alan Thompson wrote: > > I almost never use either the `comp` or the `partial`

[ANN] Modified Gorilla REPL (0.4.0)

2016-10-27 Thread Ben Bailey
Hey all, The first version of a modified Gorilla REPL has been released here: https://github.com/benfb/gorilla-repl This version makes several modifications to the original Gorilla REPL that allow it to be used as a complete programming environment: - Open any `.clj`, `.cljs`, `.cljc`, or `

Re: comp and partial vs ->>

2016-10-27 Thread JHacks
Thanks, everyone, your responses are very helpful and much appreciated. On Thu 10/27/16 09:57AM, lvh wrote: > comp takes a number of functions and returns a function. Threading macros take a > number of forms (expressions) and return an expression. The threading macro does > not need a partial,

Re: [ANN] Modified Gorilla REPL (0.4.0)

2016-10-27 Thread 'Lee' via Clojure
Awesome. FYI shift-tab to auto-reindent a selection (present in the original Gorilla REPL as well, but an essential feature IMHO that's otherwise undocumented). Some more verbose instructions for using this for newbies are at: http://faculty.hampshire.edu/lspector/Secrets-of-Gorilla-REPL.pdf

Re: comp and partial vs ->>

2016-10-27 Thread Marek Kubica
Hi, On Thu, 27 Oct 2016 12:34:19 -0700 (PDT) JHacks wrote: > For `comp`, at runtime, `(map str/lower-case)` and `(interpose \-)` > will return > transducers, and `partial` is needed to create the intended function, > e.g., `str/lower-case` bound to `map` and expecting a collection > argument. Y

[ANN] gradle-clojure 1.1.0

2016-10-27 Thread Colin Fleming
Hi all, I've just published 1.1.0 of gradle-clojure, a Gradle plugin for compiling Clojure code and running tests. You can find it at https://github.com/cursive-ide/gradle-clojure. Changes in this version are support for JUnit XML test report generation thanks to Piotrek Bzdyl, and also support

Re: Strange tooling interaction bug(?)

2016-10-27 Thread Egg Syntax
Bit belated, but did you find a solution for this? I just stumbled on the same thing with figwheel. On Saturday, October 1, 2016 at 11:39:03 PM UTC-4, James Gatannah wrote: > > I recently decided to try out devcards. I got an error because my > ancient java version is no longer supported. I've b

Re: comp and partial vs ->>

2016-10-27 Thread Mark Engelberg
On Thu, Oct 27, 2016 at 9:39 AM, Alan Thompson wrote: > I almost never use either the `comp` or the `partial` functions. I think > it is clearer to either compose the functions like Gary showed, or to use a > threading macro (my favorite is the `it->` macro from the Tupelo library >

Re: comp and partial vs ->>

2016-10-27 Thread Timothy Baldridge
I use comp all the time, not only for transducers, but also for digging into maps: (map (comp first :pets) [{:pets [:fluffy]} {:pets [:spot]}]) => (:fluffy, :spot) Partial is also handy when used with a lot of sequence functions (->> [1 2 3 4 5] (filter (partial > 3))) Sure I co

Re: comp and partial vs ->>

2016-10-27 Thread JHacks
On Thursday, October 27, 2016 at 6:24:19 PM UTC-4, Marek Kubica wrote: > > > But that is rather verbose and naming the `coll` argument is kinda > pointless, so you can simplify it to > > #(map str/lower-case %) > > And as you see, have a function which calls a function (`map`) with > the firs