Fork me on GitHub
#clojure
<
2018-10-21
>
eccentric J01:10:13

What are some thoughts between Clojure and Racket? Do you like them both? Do you prefer one over the other? Why?

dpsutton01:10:53

Racket has cool macros and documentation and stuff. Clojure pays my bills :)

dpsutton01:10:13

and that seems glib but i mean it as a sincere compliment. Clojure is a neat fun language that actually pays the bills

dpsutton01:10:47

i get to work in it monday through friday and not just as a hobby language on the weekends. Racket has some really great things. TCO, the syntax pattern matching, continuations, creating languages. But Clojure has some great things and i get to do it professionally.

seancorfield01:10:45

Yeah I'm right there with you on that. Clojure is a great language to work in and I'm happy that's my job. Racket is fascinating and a great tool for learning and experimentation -- and I've really enjoyed using it on two online courses.

ackerleytng03:10:14

which two online courses use racket?

seancorfield04:10:02

Programming Languages -- University of Washington. An Introduction to Systematic Program design -- Gregor Kisczales

ackerleytng13:10:18

Ah thanks! Programming Languages was definitely a great course!

eccentric J02:10:04

Ah cool, I’ve been playing with it slightly. Considering recommending it to a coworker to start their programming journey with. I would love to recommend Clojure but it strikes me as a bit intense for a first language.

Sieabah04:10:15

Any recommendations for someone picking up Clojure?

chrisulloa04:10:12

@jayzawrotny I like the Clojure for the Brave and True book

seancorfield05:10:34

Brave and True, or Living Clojure. @sieabah

seancorfield05:10:23

@jayzawrotny ClojureBridge has shown that you can teach Clojure as a first language successfully.

eccentric J05:10:38

Huh really? I’m working through Brave and True myself. It’s very good but I can’t help but feel emacs + cider is a beast to learn even with a lot of programming experience. Not to mention that Clojure runs on Java, and Java has a complicated installation and licensing process plus errors are not user friendly. With Racket just download Dr Racket, run it, and you’re good to go at least for a while. Learning Clojure has been a lot of choices: Java 8 or Java 9? Lein, Boot or deps.edn? Vim, Emacs, Atom, Cursive, or Calva? Clojure or ClojureScript?

eccentric J05:10:38

ClojureBridge is a workshop right? In that context I’m sure learning Clojure as a first language is doable. However, with someone trying to teach themselves I think they would find a lot more friction from Clojure compared to Racket. That said I see more value in Clojure but I think Racket would be a great way to focus on the concepts of LISP and FP before making the switch to Clojure.

McPhee05:10:48

i picked up lisp way back in the day as my second language after basic. without the baggage of other languages, i found it quite simple. years later when i went back to it, it was more difficult since I'd been OO'd into the ground. I look at clojure as lisp with access to the java standard libs in case of emergency.

eccentric J05:10:15

Agreed. The Java or JS layer underneath is a huge win for businesses and paid professionals. Which is a major reason why I believe Clojure should be the end-game if starting with Racket.

McPhee05:10:31

I'm a sysadmin. My use for it is I make a simple little tool to do something like pop a server from rotation. jar it up, give it to the release engineers. super duper simple, and all the system needs is the jdk and my .m2 to run it (systems don't have interwebs). so my use case is different from developers, but if people aree leaning towards the dark side of having root, it's a great tool to build automation for simple sysadminy tasks.

McPhee05:10:37

i was almost forced to go functional to isolate the side effects of interacting with the system via the system tools

eccentric J05:10:49

Fair point, changing my wording from developers -> professionals.

eccentric J05:10:19

Was Clojure your first language?

McPhee05:10:35

basic, then elisp, then C, it goes from there. but I don't have the mindset to be a good developer. so my mastery is very little in any of them. but then, i started back in the 90's. first professional job was migrating C++ to Java systems, with a brief stopover in visual basic when the business bought into NT 4.0's microsoft transaction server. back before java was considered production ready. those were bad times.

McPhee05:10:32

i'd stand up the servers, libraries, middleware, and then work with the devs to shoehorn it all in

eccentric J06:10:20

That’s some history 🙂 In which case I’m betting learning Clojure was probably pretty comfortable to get started with given your Java experience. I’m curious how it would go for someone who isn’t acquainted with the tech industry learning Clojure or Racket.

McPhee06:10:22

clojure was a great discovery. "lisp that runs on the jvm". i immediately dropped groovy and ported my scripts.

andy.fingerhut06:10:17

There is no need to learn Emacs+Cider to use Clojure effectively, I don't think. Throwing that at a beginner who had not used Emacs before, when also learning Clojure, does seem a bit much.

McPhee06:10:35

teaching beginning sysadmins the "automate all the things" starts with shell, then they hit the need to backslash x 6 to get that sed to work and I expand into other languages. pain is a great teacher. luckily we have intelliJ at work as a standard install. no need to try and teach emacs

eccentric J06:10:54

You’re correct you don’t have to, but that is what The Brave and True book recommends. If you’ve never worked with a code editor before will you be aware of the alternatives? Will working with emacs, even minimally to get through the book feel good or create a lot of friction?

McPhee06:10:10

20 years ago you couldn't pry emacs from my cold dead fingers. but even I couldn't quite get it working properly from the book. again, different perspective. i tried, skipped, and went with atom and protorepl, which was 2 hours to install and worked like a champ

McPhee06:10:33

'cause i'm too cheap to buy cursive at home

dpsutton06:10:58

the setup for brave is incredibly old and recommends a 3 year old version of CIDER. it also gives an emacs init to use but it includes compiled elc files which cause pain when upgrading. it needs to be modernized badly

McPhee06:10:13

that was exactly my problem

dpsutton06:10:07

> Dec 21, 2014 that's the release date of CIDER it recommends. and yeah the elc files in a repo are just bad

andy.fingerhut06:10:25

Is Brave and True setup instructions in something like a Github repo that others can contribute to easily?

McPhee06:10:48

tarball from the publisher site, i think

McPhee06:10:28

lemmie look. i have the book right here

McPhee06:10:45

yeah, book points to https://www.nostarch.com/clojure where you download a zip and move it into your emacs.d

McPhee06:10:00

i must say though, that book completely trivialized the initial lein learning curve, which is all i need to do to get people hooked

McPhee06:10:20

once they see something build into a self-executing jar, the imagination goes wild

eccentric J06:10:27

Did those people have prior programming or tech industry experience?

McPhee06:10:55

usually beginning sysadmins. so bash, sed, awk, and some perl is the extent

McPhee06:10:36

we snatch them up from the operations center if they show promise after 18 months or so of seasoning themselves

McPhee06:10:05

what with the work they do, i'm sure there's some php in there. patching and fixing wordpress modules from instructions

eccentric J06:10:19

Oof that takes me back

McPhee06:10:48

but a good crash introduction into the kinds of stuff we'll be doing as sysadmins. and it shows the people who instinctively think "wouldn't this be easier if..." and then the initiative to try it. when it breaks, we get involved and that's how we know

McPhee06:10:24

and then try to train the cowboy out of them

McPhee06:10:24

admittedly, I have limited success with that. but i'd rather have someone who tries than someone who never does

Bobbi Towers06:10:38

Clojure is my first language. Well, I did a little Racket before (reading How to Design Programs) but then hit a wall as far as being able to like, make stuff. Clojure Brave got me to learn emacs, but if you want a nice Cider setup quick, I recommend the Practicalli spacemacs guide

McPhee06:10:46

sysadmins. training civilized monsters

McPhee06:10:49

i honestly don't want to get sucked back into emacs. i know how addictive it is, but I don't have it everywhere, and our devs use intelliJ. gotta speak the language of the people

eccentric J06:10:40

@porkostomus Great insight! I’m playing with spacemacs and using that guide myself. How was the transition from Racket to Clojure?

Bobbi Towers06:10:25

I didn't learn Racket hardly at all, because once I found Clojure I was immediately sold. Except the first time I tried it I couldn't actually get it to work. Didn't even know about Leiningen

eccentric J06:10:37

Interesting, what made you come back and get it to work?

Bobbi Towers06:10:03

What finally made it click was when I found the Heroku tutorial, the "Shouter" app. In fact, I keep coming back to that one

deliciousowl06:10:28

I think if I didn't know Python and Javascript before, I wouldn't have been able to learn Clojure tbh

Bobbi Towers06:10:47

I find this topic quite interesting, because it puzzles me when I hear stuff like that

McPhee06:10:05

i've had to spend some time explaining things like stacks to people. or, even more basically, the way machine instructions are processed. having a mentor helps immensely getting over the initial learning hurdles

McPhee06:10:14

did you have someone to bounce questions off of, @porkostomus?

eccentric J06:10:17

Pretty sure I’d be in the same boat as @coinedtalk

Bobbi Towers06:10:52

not at all, I was completely on my own just reading docs

McPhee06:10:56

yeah, you're the outlier then. initially i learned from my mom, and then from the guys in my dorm. these days, the languages all smoosh together

Bobbi Towers06:10:48

I had done a bit of Python and JS before that, and actually found them much harder.

deliciousowl06:10:14

I find them more difficult now too, but not the first few months

deliciousowl06:10:37

for example: "this is how you would implement a for loop in Clojure" but if you don't know what a for loop is...

deliciousowl06:10:00

or Brave Clojure which immediately starts scaring you with recursive functions

McPhee06:10:35

🙂 there's definitely a brain twist involved in that if you haven't done assembler. people tend to think linearly. even if they don't act so in their lives

McPhee06:10:31

or basic, even. it's been a while, but that was all gotos. and we planned it out on paper in the computer lab

McPhee06:10:13

so, this is interesting. it will help train the new folk. what is the best way to get people to think recursively?

Bobbi Towers06:10:24

when you start to "get" Clojure, there's a point when you realize the immense power that is in your hands, and that excited me so much that it was like getting struck by lightning. Suddenly I was on fire

McPhee06:10:15

seriously. it's been 25 years and i STILL remember when i got it and the little dungeon game i was working on started building itself

eccentric J06:10:35

That’s what inspired me to try and find the best LISPy FP language to recommend to absolute beginners. Previously, I had recommended Python just since it’s so common and fairly easy to get started with but I think Clojure or Racket are simpler. I just think to a less tech savvy beginner Racket is going to allow them to focus more on the problems of designing their programs versus the tooling to get started.

McPhee06:10:32

if it's a tooling problem, what's the best way to get the tools into people's hands? I have a VM image that I give to my folk

deliciousowl06:10:22

self-installers

deliciousowl06:10:41

something you click and get started right away

deliciousowl06:10:08

on windows its kind of a pilgrimage sometimes to get it to work

eccentric J06:10:07

That makes sense in your field McPhee. In my case a former event planner has expressed interest in learning programming. I’m not sure Clojure is going to be accessible enough to them out of the gate.

McPhee06:10:16

agreed. i'd like to get a simpler system. and yeah, taking a good look at nightcoders

deliciousowl06:10:41

imho, also beginners should get started out with parinfer and bracket highlighting

deliciousowl06:10:53

because most people are put off by the lisp syntax obviously

Bobbi Towers06:10:53

I had come from learning to do webapps on http://pythonanywhere.com, so that was like the Clojure version of that

eccentric J06:10:39

Agreed with parinfer and bracket highlighting.

McPhee06:10:46

definitely

deliciousowl06:10:05

Maybe something like 'recommendations' on the clojure page where its visible

Bobbi Towers06:10:07

those things actually annoyed the crap out of me, because I always loved the parens

deliciousowl06:10:59

'among other tools, our community likes to use: ... "

McPhee06:10:03

it's the language. the standard code blocks are too small to do normal indented parens (or braces in other languages)

orestis06:10:47

How about Maria.cloud?

👍 4
McPhee06:10:05

but yeah. something like links to the protorepl guy's gist, which made setup a "follow the bouncing ball"

eccentric J07:10:02

I’ve been playing with maria.cloud. I was going through some of the lessons from Clojure Brave and True but hit a wall when some code doesn’t work and I find out it’s because it runs ClojureScript instead of Clojure. Not that it’s a deal breaker, just depends what level of a beginner they are.

McPhee07:10:58

I think having a quick guide for the more visually inclined is a good thing for sure

deliciousowl07:10:20

I think the Clojure community defines a beginner differently than something else like Python

💯 4
deliciousowl07:10:31

in Python it's assumed that you are a semi-sentient ape that has managed to obtain a computer

deliciousowl07:10:41

and MAYBE can do multiplication

Bobbi Towers07:10:45

yeah, it's similar to Racket's "picture language" in "How to Design Programs"

McPhee07:10:28

considering how often I resort to the whiteboard and draw boxes with arrows, there's definitely utility in it

deliciousowl07:10:12

I wonder if you could represent clojure programs like Pd (Puredata)

McPhee07:10:36

badly. pictures don't do recursion well past the first few looping arrows

McPhee07:10:56

just look at those videos on "teaching you monads". it's such a simple concept if you know math past algebra, but we still find ourselves overcomplicating them

Bobbi Towers07:10:32

If there's any doubt that Clojure can be a great first language, you need to see Power Turtle http://timothypratley.github.io/power-turtle/

eccentric J07:10:22

This is awesome but it hasn’t erased my doubt yet.

bbss07:10:10

I think it's a good first language because the syntax is small, the core language is small, symbols are first class.

McPhee07:10:12

there's a problem in that if you try to explain it up front. i wait for people to ask "but what if I want * to be something else?" in most languages the answer is "tough luck". and people accept it.

bbss07:10:15

additionally the repl approach makes it so much more playful, and experimenting is key to learning new stuff

McPhee07:10:05

would a vim-adventures approach work? a tutorial where you have to unlock functions based on mastery of the previous ones?

McPhee07:10:54

I'm not sure that works with a full language or not. as a way to learn a tool, it works

eccentric J07:10:10

Actually, I take that back. I’m sure Clojure can be a great first language but there’s lot of specifics that need to be abstracted or hidden from beginners. With Racket you can give them a full language, PDE, REPL, and graphics environment within minutes just from downloading DrRacket.

bbss07:10:16

I think Racket is a great choice too, I don't know if you really need to abstract or hide that much with Clojure though.

eccentric J07:10:54

Well, depends where they’re coming from I think. If they have at least tech experience installing Java, Lein, a code editor, and a repl\clojure plugin isn’t a big deal but for an OS X user who doesn’t even have homebrew I see potential for all that to become a pretty steep hill.

bbss07:10:26

Ecosystem install friendliness has come a long way recently, but I'm sure it could be better.

eccentric J07:10:44

That’s true, it is getting better.

McPhee07:10:31

my people are comfy on the CLI and frustrated with restricted languages like the puppet PDL, but are entirely comfortable building complex toolschains. do devs fall into the same camp?

eccentric J07:10:20

I think so, I’m sure there are exceptions but I bet majority feel pretty comfy with CLIs.

McPhee07:10:34

but i've seen hesitation from our project manager types to even look at a terminal. they want the web browser or MS Word experience

👆 4
deliciousowl07:10:18

there is no way to underestimate how low the entry level can go

deliciousowl07:10:28

we're all just used to it

McPhee07:10:42

true, but if they're on a computer asking questions we can make some base assumptions

deliciousowl07:10:22

guitar players are always shocked when people do something like put multiple fingers on one string, because to them that possibility didn't even exist

McPhee07:10:41

there's nothing wrong with doing the full IDE route. I'm wondering if the two approaches are mutually exclusive, or at least not worth the costs in lost functionality

eccentric J07:10:48

Is a project manager considered a developer?

deliciousowl07:10:59

I don't think the language itself should be changed

McPhee07:10:09

nah, but they hang out with 'em every day. and occassionally want to poke and see if they can do it too

deliciousowl07:10:27

yep every project manager I know is now on a python trip

McPhee07:10:56

plus, never underestimate the complexity of creating JIRA workflows and those weird charts. that's programming, no two ways about it

McPhee07:10:29

so, with python, it's "install this .msi then run python in your cmd", or do the PMs have a different way of getting their feet wet?

McPhee07:10:51

i know my thinking always reverts back to package installs and CLI. so my questions may seem obvious. sorry about that

eccentric J07:10:58

All good, I share your curiosity

McPhee07:10:12

well, the nightcoders editor is absolutely fabulous. but it will need some tutorial stuff and import functions to give to beginners.

McPhee07:10:52

i mean, "go to this URL, sign in with google, and click this button" is right up the alley of the PM types

Bobbi Towers07:10:52

It's cool because you can do games and music projects, and it leads naturally into his other project LightMod, which gives you some great templates for Reagent, Rum, H2 Database, and a Sente chat app

McPhee07:10:06

and the ability to build an internal one will assuage some of the business folk. that's extremely generous of the devs

McPhee07:10:32

i mean, that editor is REALLY good. it has all the features i spent an hour making work in atom

McPhee07:10:33

is it a fully functional closurescript environment? i see library importing, but curious if it's out of the box fully geared

Bobbi Towers07:10:40

yeah you just can't do any server side code

Bobbi Towers07:10:09

for that you need LightMod

McPhee07:10:29

ahh, that would explain it. was trying to get it to plug into my f5 ltm 🙂 simply some code i know

McPhee08:10:28

well, there's your full stack. i can do all my things in it. not comfy, i need my tools, but simple stuff is completely doable

deliciousowl08:10:31

wondering whether CLJS is more approachable

McPhee08:10:26

it would probably be for people who's experience is with apps and browsers and not dev environments

McPhee08:10:21

it's easier to convince someone to try something if they're working in a comfortable space

McPhee08:10:46

i know nothing of the language, though. what are the oddities, etc

deliciousowl08:10:10

number precision is really weird (like js)

deliciousowl08:10:33

regexes are different

deliciousowl08:10:45

https://clojurescript.org/about/differences few other gotchas but those are the ones that tripped me up

McPhee08:10:40

huh. i think i could work within these limitations. the question is, will it throw off someone first coming to it

McPhee08:10:31

the joy of writing type checking code to deal with dynamic typing is why I don't recommend python to new programmers anymore

McPhee08:10:27

i mean, let's be clear, you must always check your inputs, etc. but for someone first dipping their toes in, you don't want to drown them in a checklist of rules

McPhee08:10:00

well, that's a whole other discussion, though. because i have an end-goal of what i want folk to do.

lsund14:10:37

hello! I'm trying to define my first "usable" macro and I am hoping to get some help here. This is the macro, which is supposed to define a curried function, like haskell does it by default.

(defmacro defcurry [name fn-to-call & args]
  `(defn ~name [args]
     (partial (apply ~fn-to-call args))))
My expectation is now to define curried functions in the following fashion:
(defcurry print-hello println "hello") 
Calling the print-hello function would always print hello, in addition to any other argument
(print-hello "world")
;; hello world
The problem is that the above defcurry definition does not work:
clojure.lang.ExceptionInfo: Call to clojure.core/defn did not conform to spec:
                                         In: [1 0] val: trainer.html/args fails spec: :clojure.core.specs.alpha/arg-list at: [:args :bs :arity-n :bodies :args] predicate: vector?
                                         In: [1 0] val: (trainer.html/args) fails spec: :clojure.core.specs.alpha/arg-list at: [:args :bs :arity-1 :args] predicate: (cat :args (* :clojure.core.specs.alpha/binding-form) :varargs (? (cat :amp #{(quote &)} :form :clojure.core.specs.alpha/binding-form)))
... and so on. However, the macroexpansion of the defcurry definition looks right:
(defn print-hello [args] (partial (apply println args))) ;; after calling cider-macroexpand-1 on the `(defcurry ...)` above
Can someone help me? What am I doing wrong?

dpsutton15:10:02

in your macro you call apply. that seems to be what you want to happen later

dpsutton15:10:22

a little bit more clearly. apply does not return a function. so "partialing" the result of apply doesn't seem beneficial

moxaj15:10:50

@lsund also, that macroexpansion does not look right, maybe cider hides the namespaces automatically?

moxaj15:10:23

in the error message, you can see the problem: your args argument is qualified to trainer.html/args

moxaj15:10:51

also, there's 2 args in your example

lsund15:10:14

You are right, this does not look right. It was maybe premature to post it here. I'll look in to it and get back to you. Thank you for the pointers!

kwladyka16:10:30

I am trying to understand licences. I want to publish library. Why EPL is not here https://choosealicense.com/licenses/ ? I am looking simple explanation to understand comparison MIT vs EPL. I guess I should choose between them. There is a lot of articles about licences, but on the end I don’t understand how to choose. Somebody already learned it and can share his thoughts?

andy.fingerhut17:10:09

Click on the "appendix" link of that page to see info about more licenses

kwladyka17:10:17

I don’t know any with eclipse public license 2.0

kwladyka17:10:04

Ok it is easy to find them by github search license:epl-2.0 https://github.com/eclipse/che/blob/master/LICENSE thx

kwladyka17:10:55

> Patent use What this point is about?

andy.fingerhut19:10:41

All of the column titles in the table are clickable to take you to a brief description below.

andy.fingerhut19:10:05

If a software license does not mention patents at all, it leaves projects that use it open to the possibility that someone may contribute code that obeys the license, but intentionally violates a patent that the contributor owns, so a malicious entity could cause legal trouble for the project.

andy.fingerhut19:10:55

If the software license explicitly says that all contributors grant any and all patent licenses required to use the contribution, the project should be able to avoid that possibility.

kwladyka06:10:18

So MIT vs EPL EPL has “patent use” protection and force to keep source open. Is it right summary? Thank you for explanation.

kwladyka06:10:54

“disclose source” is only about repository (library)? Not code which use this library as a dependency?

kwladyka07:10:16

So what developers have to do to use my library? Can they use it and don’t care? Because library is on github so source in available?

kwladyka07:10:49

Any risk for them about be forced to public source code of they app?

andy.fingerhut20:10:27

If you want actual legal answers, an intellectual property attorney is best (and unlikely to be free). That and reading the actual agreements and commentary about them that can probably be found on line (more often by non-lawyers than lawyers). The summary table on that page is intentionally brief, to quickly compare the major aspects of many licenses.

andy.fingerhut20:10:03

As far as I have ever heard, you can take GPL'd source code, make modifications to it, run it on your own computers, and as long as you never give the binaries to anyone, you are not legally obligated to give them source code. You can even run it on a web server that you own or control, and let people interact with it, and not be legally obligated to distribute your modified source code.

andy.fingerhut20:10:53

If you want to distribute the compiled executable code to other people, though, then the GPL requires you to give them source code if they ask for it. Most people choose simply to publish the source code in a public Internet place, rather than responding to personal requests.

andy.fingerhut20:10:55

My quick reading of the EPL seems to imply that you can distribute binaries of the code, or other code linked with it to make a larger system, without releasing the source code of the parts they added. If they choose to release source code of a modified version of something they received under the EPL, they must do so under the EPL.

kwladyka09:10:28

Well in my experience lawyer has to specialise in licenses to trust his answer. I don’t know anybody with this specialisation. That is why I am looking answer here 🙂 Oh so it is even possible to do SaaS with it. Interesting. > give them source code if they ask for it Code of the library or code of the full app which use this library? So please if we can make it clear: EPL license. Can developers use library as dependency without risk to be forced to share code of the app when they distribute binaries? Even mention about this dependency in agreement.

andy.fingerhut17:10:35

It is my understanding that with many licenses, such as EPL, Apache, MIT, and BSD, anyone can take code released under any of those licenses, incorporate it as part of a closed source project, and release binaries, with no obligation to release any source code at all, even if there are modifications they made to the parts of the software covered under those licenses.

andy.fingerhut17:10:44

If you rely on this information and are sued, I am not liable 🙂

andy.fingerhut17:10:56

The above is definitely not true for code released under GPLv2 or GPLv3

andy.fingerhut17:10:58

I believe it is mostly the case for code released under LGPL (the Library GPL), except that if you distribute binaries of code created from modified versions of LGPL code, you must offer source code of the changes made to the code released under the LGPL, but not any other code it is linked with.

kwladyka19:10:45

> If you rely on this information and are sued, I am not liable haha sure 🙂

kwladyka19:10:20

thank you. Seriously 🍻

richiardiandrea23:10:35

Is somebody using transit in their API? Is it based on the Accept header? I am thinking of accepting application/transit+json similar to application/hal+json but wanted to ask around first