Re: Java learning resources for Clojurists?

2017-08-15 Thread Paul Gowder
Oh, thank you, that looks like a great resource!

On Tuesday, August 15, 2017 at 9:24:45 PM UTC-5, Daniel Compton wrote:
>
> Eric Normand has a course "JVM Fundamentals for Clojure" which might be 
> useful? https://purelyfunctional.tv/courses/jvm-clojure/
>
> On Wed, Aug 16, 2017 at 2:20 PM Paul Gowder <paul@gmail.com 
> > wrote:
>
>> Hi there, 
>>
>> Can anyone recommend decent resources for learning Java for experienced 
>> Clojurists who don't do enough interop?  
>>
>> After writing Clojure for about a year and a half, I find that the most 
>> continuous barrier I encounter is in understanding how to drop down to the 
>> JVM.  And it's even a barrier in using some core CLJ libraries.  
>>
>> Here's an illustration of the problem I often have.  I was writing a web 
>> application using Reagent/Immutant, and I wanted to pass data from frontend 
>> to backend over a websocket in transit format. But the only example in the 
>> github readme for Transit-CLJ involves dealing with data as a Java 
>> bytestream.  And it was just too daunting to try to figure out what flavor 
>> of JVM string the stuff being received over the websocket was under the 
>> hood, how to cast it into a bytearrayinputstream or whatever else can fit 
>> into a transit "writer," etc. Or even just like where to start translating 
>> from "here, I have a Clojure string" to "oh god, now it has to turn into 
>> some kind of low-level object that isn't a string and isn't a file but is 
>> something in between and maybe it has to be a stream and maybe it doesn't 
>>
>> Yet almost all "how to learn java" materials I can turn up seem to be 
>> directed at total beginner programmers, and start with stuff like "here's 
>> what a for loop is" rather than practical stuff like "here's how to sort 
>> out the different kinds of array-whatsits and byte-whatsats" or "here's how 
>> the entry point of a java library works" or whatnot. 
>>
>> I'm hoping there's something out there (that goes a bit deeper than the 
>> wonderful-but-not-quite-what-i-need interop chapter in Brave and True) that 
>> someone can recommend.
>>
>> thanks!
>>
>> -Paul
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Java learning resources for Clojurists?

2017-08-15 Thread Paul Gowder
Hi there, 

Can anyone recommend decent resources for learning Java for experienced 
Clojurists who don't do enough interop?  

After writing Clojure for about a year and a half, I find that the most 
continuous barrier I encounter is in understanding how to drop down to the 
JVM.  And it's even a barrier in using some core CLJ libraries.  

Here's an illustration of the problem I often have.  I was writing a web 
application using Reagent/Immutant, and I wanted to pass data from frontend 
to backend over a websocket in transit format. But the only example in the 
github readme for Transit-CLJ involves dealing with data as a Java 
bytestream.  And it was just too daunting to try to figure out what flavor 
of JVM string the stuff being received over the websocket was under the 
hood, how to cast it into a bytearrayinputstream or whatever else can fit 
into a transit "writer," etc. Or even just like where to start translating 
from "here, I have a Clojure string" to "oh god, now it has to turn into 
some kind of low-level object that isn't a string and isn't a file but is 
something in between and maybe it has to be a stream and maybe it doesn't 

Yet almost all "how to learn java" materials I can turn up seem to be 
directed at total beginner programmers, and start with stuff like "here's 
what a for loop is" rather than practical stuff like "here's how to sort 
out the different kinds of array-whatsits and byte-whatsats" or "here's how 
the entry point of a java library works" or whatnot. 

I'm hoping there's something out there (that goes a bit deeper than the 
wonderful-but-not-quite-what-i-need interop chapter in Brave and True) that 
someone can recommend.

thanks!

-Paul

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: Cognitect acquired by Microsoft

2017-04-01 Thread Paul Gowder
AMAZING.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Combinatorics partitions that preserves adjacency?

2017-03-16 Thread Paul Gowder
For sake of completeness/if this is useful for anyone else, a full 
implementation of the number-the-possible-split-locations method, including the 
original API with :min and :max options. Could probably be tidied up with 
transducers and such for all those filters but does the job. 

(require '[clojure.math.combinatorics :as c])
(defn breaks->partition 
  ([v brks]
   (breaks->partition 0 [] v brks))
  ([start pars v brks]
   (if (empty? brks)
 (conj pars (subvec v start (count v)))
 (let [this-part (subvec v start (first brks))]
   (recur (first brks) (conj pars this-part) v (rest brks))

(defn min-parts [min splits]
  (>= (count splits) (- min 1)))

(defn max-parts [max splits]
  (<= (count splits) (- max 1)))

(defn ordered-partitions [v & {:keys [max min]}]
  (let 
[s (c/subsets (range 1 (count v)))
 fs (cond
  (and max min) 
  (filter 
(partial max-parts max) 
(filter (partial min-parts min) s))
  max (filter (partial max-parts max) s)
  min (filter (partial min-parts min) s)
  :else s)]
(map (partial breaks->partition v) fs)))

It does, alas, take more than 10 times as long as Mike's version.  Which proves 
that one should never try to do anything faster than the core.matrix guy.  :-) 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Combinatorics partitions that preserves adjacency?

2017-03-16 Thread Paul Gowder
Ooh, thank you---those are both lovely solutions! 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Combinatorics partitions that preserves adjacency?

2017-03-15 Thread Paul Gowder
Hi everyone, 

Does anyone know of a straightforward way to get something like 
clojure.math/combinatorics/partitions that works more like partition in the 
core library, that is, that only selects partitions with adjacent elements?

In other words, right now this is the problem:

(require '[clojure.math.combinatorics :as c])
(c/partitions [:a :b :c] :min 2)

=> (([:a :b] [:c]) ([:a :c] [:b]) ([:a] [:b :c]) ([:a] [:b] [:c]))

But that ([:a :c] [:b]) there in the second position isn't a proper partition 
because :a and :c aren't adjacent in the original vector.  

I feel like there's got to be a standard, canonical solution for this, or some 
existing sequence or combinatorics function with a funny name that just returns 
(([a :b] [:c]) ([:a] [:b :c]) ([:a] [:b] [:c])) in this situation.  I just 
don't know it... 

The best I can come up with is kind of a hackish workaround that only works 
when the original vector is sorted, namely, flattening all the partitions and 
testing to see whether they are sorted too, i.e.: 

(require '[clojure.math.combinatorics :as c])

(defn test-fn [part]
  (let [f (flatten part)]
(= f (sort f

(filter test-fn (c/partitions [:a :b :c] :min 2))

=> (([:a :b] [:c]) ([:a] [:b :c]) ([:a] [:b] [:c]))  ; Yay! :-)

And that works, but, as noted, only when the original vector is sorted.  What 
if someone wanted to preserve adjacencies in an unsorted vector?

All thoughts appreciated, thanks!

Cheers,

-Paul

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: ClojureScript 1.9.456, Externs Inference & Comprehensive JS Modules Support

2017-03-07 Thread Paul Gowder
Yeah, this is a recurrent problem---as far as I can determine, several database 
libraries (at least) have a dependency a layer or two down on an old version of 
guava; the latest closure compiler seems to be depending on the most recent 
guava. See eg this issue (which ai've been meaning to pr...) 
https://github.com/clojurewerkz/support/issues/4

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Nightcoders.net, a cloud IDE for ClojureScript

2017-01-04 Thread Paul Gowder
That's really cool!  The autosave is sweet.  So is the fact that I can get 
it to work on ios---I was just thinking about buying an ipad pro and 
figuring out good ways to code on it... this could be a really cool 
solution for starting something on a real computer, leaving it in the 
cloud, working on it on the ipad, etc.  

The oauth doesn't seem to work for me in chrome (on sierra with a ton of 
ad-blockers and such, so that might be giving grief)---I hit the sign in 
button, it pops up the standard google account chooser, I choose an 
account, then the window closes and nothing happens.  But it works in 
safari just fine (with the same double-click issue reported elsewhere in 
this thread). 

Oh, one other little thing I noticed... it's not obvious how to close a 
project and get back to the first screen, like to start on a different 
project.  I ended up just hitting the back button then reload...

This is amazing!

On Wednesday, January 4, 2017 at 10:20:20 AM UTC-6, Zach Oakes wrote:
>
> Cloud IDEs are becoming more common. To quote the rifleman's creed, there 
> are many others like it, but this one is mine:
>
> http://nightcoders.net/
>
> It's basically a hosted version of Nightlight, running the compiler on my 
> server so you can build CLJS projects using nothing but a web browser. I'm 
> aiming at beginners, much like I did with the original Nightcode, but this 
> time I'm going further by eliminating all setup requirements.
>
> Please be gentle with it. I've only been working on this for the past few 
> weeks while vacationing in mexico...mostly as a distraction while my body 
> convulsed over the somewhat unhygienic street food I gave it. I spent a lot 
> of time in the bathroom. That may be oversharing. Oh well.
>
> Enjoy!
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: recursive bindings not available in let form?

2016-12-03 Thread Paul Gowder
That's a really neat post. Thank you for writing it!  

How do bindings created by let fit into that picture? 

> The question of how vars work comes up enough that I recently wrote a blog 
> post on the subject. Maybe it will be useful to you. 
> http://blog.cognitect.com/blog/2016/9/15/works-on-my-machine-understanding-var-bindings-and-roots
> 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: recursive bindings not available in let form?

2016-12-02 Thread Paul Gowder
Thanks Bobby, Francis, Walter!  Now trying to wrap my head around the idea 
of def as a ref... 

On Friday, December 2, 2016 at 2:57:13 PM UTC-6, Francis Avila wrote:
>
> Let bindings are immutable bindings, not refs. They must act as if their 
> value could be substituted at the moment they are referenced. Def (i.e. a 
> ref) is a mutable container whose contents is examined when it is used (not 
> when referenced), which is why your second example works.
>
>
> Why doesn't let work how you expect? Well, how would the following code 
> work if let worked as you intend?
>
> (let [a 1
>   a (+ a 2)]
>   (= a 3))
>
> However, fn  accepts an optional name binding, so you can do this:
>
> (let [fib (fn fib [...] (fib ...))] fib)
>
> The inner fib reference is bound by the fn form, but the outer fib 
> reference is still bound by let.
>
> Or you can use letfn instead of let, which is the same as above with less 
> typing AND the bindings can all see one another simultaneously. It's best 
> for groups of closed-over  but mutually recursive functions.
>
> (letfn [(fib [...] (fib ...))] (fib ...))
>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


recursive bindings not available in let form?

2016-12-02 Thread Paul Gowder
Hi clojure-world, 

I think maybe this is actually related to the complexities of binding 
referenced in the previous thread 
(https://groups.google.com/forum/?utm_source=digest_medium=email#!topic/clojure/zBXsrqTN2xs)...
 
maybe?  But it would be amazing if some wise person would help explain... 

So for obscure reasons, I found myself trying to use a naive recursive 
fibonacci function interactively.  So naturally, the first thing my fingers 
went to was: 

(let [fib (fn [x] 
  (cond
(< x 2) x
:else (+ (fib (- x 2)) (fib (- x 1)]
(fib 5))

which threw an unable to resolve symbol error because it couldn't resolve 
the recursive calls to fib inside the let binding. 

But swap out the let for a def and it works just fine:

(def fib (fn [x] 
  (cond
(< x 2) x
:else (+ (fib (- x 2)) (fib (- x 1))
(fib 5)

Can someone clarify for me what's going on here?  Why can a def binding get 
access to its own name in the body of a function, but not a let binding?

thanks!

-Paul

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: protocols and namespaces confusion (with an example from core.matrix)

2016-10-19 Thread Paul Gowder
Thanks Gregg and Alex!  I didn't realize that protocols (or the black magic 
interfacing of core.matrix) were that fancy.  Definitely going into my "code to 
really dig into" list.

Cheers,

-Paul

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


protocols and namespaces confusion (with an example from core.matrix)

2016-10-19 Thread Paul Gowder
Hi folks, 

I have a kinda basic question (I think?) that I should really know the 
answer to after writing Clojure for like 8 months, but don't.  It's about 
requiring namespaces with protocol definitions in them but not the actual 
implementations of those protocols, and how it works.  

tl/dr: if a protocol is defined in namespace a and implemented (extended to 
the type at issue) in namespace b, can you call functions from it in 
namespace c where namespace c only requires namespace a, not namespace b?

Backstory: I was poking around core.matrix recently in pursuit of 
restarting work on a months ago issue I promised to work on, and it looks 
like at least one namespace calls a function it shouldn't be able to call.

So: clojure.core.matrix.impl.pprint requires only one namespace within 
core.matrix, clojure.core.matrix.protocols. (I'm going to use ... hereafter 
to stand for clojure.core.matrix.) ...protocols defines a protocol 
PSliceSeq2, which gives the name, docstring, etc. for a function called 
get-slice-seq. PSliceSeq2 is actually implemented for the generic object 
case in ...impl.defaults and for ISeq in ...impl.sequence. 

But ...impl.pprint calls ...protocols/get-slice-seq. And it seems to work. 
 Even though I can't find either ...impl.defaults or ...impl.sequence 
anywhere in the dependency tree for ...impl.pprint.

This is a puzzle to me.  I mean, the ...impl.pprint namespace will 
typically be required from some other namespace, and presumably that 
higher-level namespace will require everything that one needs. But still, I 
hadn't thought that one would be able to call get-slice-seq in a function 
in ...impl.pprint without requiring a namespace that actually defines the 
function, as opposed to just defining the protocol.

So can someone explain how this magic works?  Is the compiler just way 
smarter than I thought it was, and capable of figuring this stuff out on 
its own?

Thanks!

-Paul

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Should I switch to Clojure after 3 years of learning another full stack ?

2016-10-13 Thread Paul Gowder
Another thing worth thinking about is that Cojure(script) is great for pure 
front-end applications ("single page applications").  The reagent library is a 
scarily magical way of just abstracting away the dom, and figwheel is a scarily 
effective build tool. This template is a convenient way to get started: 
https://github.com/reagent-project/reagent-frontend-template.  I actually built 
a static site using reagent once, hard-coding the content into the 
clojurescript for shits and giggles gowder.io), but that's pretty stupid. :-)

If you don't need to do anything heavy server-side, reagent might be a good 
starting point, and then no need to think about things like webservers and 
databases and routing. 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure as first language

2016-03-20 Thread Paul Gowder
Thinking about this a little more, it seems to me that the real 
beginner-unfriendly bits of clojure that actually are a problem for basic 
learning (so not legitimately difficult stuff like quoting and macros) all come 
from the JVM.  Errors that are incomprehensible? JVM. Classpath confusion? JVM. 
Need for tooling and complex directory structures? That's probably the JVM too. 
Having to wrap half of the verbs you use in anonymous functions in order to get 
them to map and filter and reduce and such because they're really methods that 
have arcane and incomprehensible rules about whether they're "static" or 
(whatever the opposite of static is) and have to be attached to nouns to make 
them do work? Oh hai JVM.  Lack of tail call... Well... Yeah.

So... what do folks think about something like Hy for beginners instead? All 
the Lispy goodness, all the "hey there's a serious batteries-included library 
back here" hosting, but with a kind and gentle Dutch hug behind them instead of 
the punch in the face that is the JVM? After all, the slow performance of 
Python isn't a big deal for total beginners, and total beginners also don't 
need all the sexy advanced stuff like concurrency that makes Clojure worth the 
JVM pain. 

craxy thought... But not insane?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure as first language

2016-03-19 Thread Paul Gowder

On Thursday, March 17, 2016 at 12:10:21 PM UTC-5, blake watson wrote:
>
> On Sat, Mar 12, 2016 at 2:42 PM, Lee Spector  > wrote:
>
> > Is "lein new app foo" that complicated?
>
> If I understand Paul correctly—and am not just imposing my own similar 
> feelings on him—the problem is not that "lein new app foo" is complicated, 
> it's that it creates a directory structure that is complicated for the 
> beginner. Clojure is by far not the worst in this regard, but a new app 
> creates seven folders (root, doc, resources, src, test, src/root and 
> test/root) and nine files (.gitignore, .hgignore, CHANGELOG.md, LICENSE, 
> project.clj, README.md, intro.md, core.clj and core_test.clj). This is a 
> lot for someone just trying to grasp "Hello, world."
>
> The less you have to say to the student ("you can ignore all that for 
> now") the better. The less you have to tell the user to toggle mysterious 
> switches (as with the JVM stack options) the better.
>
>

Partly this, yes.  And partly also that there's a lot of semi-documented 
magic behind the scenes.  For example: leiningen has "new" and "new app." 
The tutorial says that they're different, and that one is appropriate for 
applications and the other for libraries, but doesn't offer any clue why, 
or what the differences might be---and it's hard to see, even coming from 
other languages, why there might be a reason for the difference. Is it 
something about namespacing and some kind of "main" path through the code 
for applications?  That's just my guess... 

Or the classpath.  Apparently this is a JVM thing, and leiningen hides it 
from the user, but sometimes it breaks, and then it's kind of a guessing 
game why unless one knows Java.  

And it doesn't help that it also makes unintuitive default decisions for 
one sometimes.  For example, I actually just spend several hours last night 
beating my head against the REPL's refusal to let me use core.matrix in a 
library I'm working on---it took a SO post plus some good luck to learn 
that core.matrix requires clojure 1.7+, and then notice that for some 
mysterious reason the version of leiningen I didn't install all that long 
ago defaulted to 1.6.   (The REPL, of course, didn't actually throw an 
error that gave any hint that there were version problems; the dependency 
just silently failed, and then when I tried to use the namespace that 
required core.matrix, it just threw an incomprehensible error claiming that 
it couldn't find the file --- see 
http://stackoverflow.com/questions/36051140/clojure-classpath-troubles-loading-code-and-dependencies-with-leiningen/36052171#36052171
 
--- that's just unfriendly behavior.)

Don't get me wrong. I'm not complaining. The more I learn about leiningen, 
the more I like it---the power to just swap out language versions 
altogether by changing one line in a config file, for example, is 
wonderful---and makes a lovely contrast with, for example, the Python 2/3 
craziness. But the fact that there's a ton of machinery going on behind the 
scenes to actually get anything running, even with good tools that abstract 
it away (when they work right), makes the ecosystem less beginner-friendly, 
because when something goes wrong it's a beast to figure out why. 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure as first language

2016-03-11 Thread Paul Gowder
As a clojure beginner and programming semi-beginner (advanced beginner? I'm 
decent but not pro dev level at Python and R and have messed around with a few 
others), switching to clojure because the functional style feels more natural 
than all that object ick, I can speak from personal experience here:

1.  Yeah, the stack traces are horrible.  
2.  The other big beginner barrier I feel is the tooling.  In lots of ways, 
leiningen is amazing (particularly the automatic grabbing of dependencies), but 
the forced project structure is really painful. It feels like a massive barrier 
to not just be able to throw up some code and have it run without having to set 
up a whole directory structure and all the rest.  (It would be nice in 
particular to be able to use gorilla-REPL without having a project for 
it---maybe with lein-try somehow??)  Been thinking about trying boot to make 
this simpler, but since every library seems to be documented in terms of 
leiningen, that means just means learning two tooling systems instead of just 
one.  

So just from my standpoint, those are the two big things to work on to make 
clojure appropriate as an absolute beginner language.  

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.