Thanks @cjtan but I think I’m at the stage where more information would overflow onto the floor. I need to practice.
Tried to set Clojure up on a Mac and had completely forgotten how I did it on Linux, so I’ve written some notes that link to all the bits you need and attempt to explain why. Please don’t ask any questions about the nREPL.
λ brew search clojure clojurescript ~ If you meant "clojure" precisely: Clojure isn't really a program but a library managed as part of a project and Leiningen is the user interface to that library. To install Clojure you should install Leiningen: brew install leiningen and then follow the tutorial: https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md
Clojure is a language compiler, implemented as a .JAR on the JVM, so I’m not quite sure what they’re getting at. ClojureScript is an equivalent, targeted at JS in the browser, so I’d say they are the same language but with different libraries for the 2 environments. Leiningen is the REPL and configuration tools for an interactive environment.
The interesting bit is CIDER which is a client-server pair, the client part living inside emacs, written in eLisp and the other living in nREPL, part of Leiningen, written in Clojure.
I think I’ve understood what @paulspencerwilliams was doing in his demo to the Functional Programming Meetup, for the first time; connecting from emacs windows to 2 different instances of nREPL, dynamically hacking the Clojure back-end code and ClojureScript front-end code at the same time.
I’m still quite impressed that you can hack the emacs session that you’re running to do the edit so you can add a function you need. See: recursion. No wonder Lispers always have crazy hair.
I decided that my emacs incompetence had to be dealt with, so I’ve gone back to that chapter and worked through, making myself a cheat-sheet for all the key bindings. I still consider Cider to work by magic but I’ve been hacking in one emacs window with the output appearing in the Cider REPL window tonight, so the magic works. At one stage, I accidentally had 2 REPLs running and was watching the wrong one.
I hadn’t noticed that emacs calls the X window a ‘frame’ and its ‘windows’ are within that frame, until the book pointed it out.
This is Emacs all over. So many of the features have weird names, presumably because the concepts we’re yet settled when the functionality was first developed.
Exactly. I used X before Microsoft Windows. I still think client-server is wrong. The PC is clearly the display server for the client programme and the client of the database server.
I fixed Leiningen on the Raspberry Pi 2 by increasing the timeout from 30s to 4 min. 2 minutes wasn’t enough :-/
In case the problem was my lack of a project directory, I created an application. I didn’t need one so I called it ‘wizard’, thinking I could try out code for my kids book. When it worked my new prompt was:
Time well spent, I feel.
I’ve added an emacs.md cheat-sheet to my
It covers bash command-line editing, general emacs and some extras for Leiningen /Clojure and CIDER. It probably isn’t complete yet but it’s all I (don’t) know.
The page-break style works and is hidden by the view mode of the ReText Markdown editor, but apparently not by github.
I’ve been playing with some graphics in quil. I wanted a diagram and thought I might as well make life hard for myself by doing it in Clojure. I decided I should check if there are other graphics libraries before I go too far and I found this useful resource
I keep losing this link so I’m putting it here. See ‘Overtone’, the Clojure front-end to the Supercollider sound synth engine, accessible from Leiningen & emacs http://sam.aaron.name/. There’s a worrying lack of github commits since 2014 though.
I wonder, could @LimeBlast make a musical instrument out of all his buttons? (I’ve thought about registering the domain ‘Birmingham Buttons’ before.)
I’ve been ignoring my Clojure learning again, so all the emacs keys have fallen out of my brain but last night I decided to recreate an example I found in JSON & XML as a Clojure data structure. I pasted it to the Slack a few minutes ago. It’s a 2-level hash-map but the interesting thing to me was the way you de-reference the data values: the map is a function. That seems incredibly powerful, in a way I’m not sure I’ve actually understood yet. Maybe it’s just a more explicit way of seeing the advantages of working in a REPL and dynamically dragging in the tools you need, but to this old compiler-user, it feels like magic.
It took a year and a lot of Hickey videos but I think I get it now. He talks a lot about things being “complect”, multiple, over-lapping strands. He believes in separating the threads, so I think it’s about the old chestnut ‘separation of concerns’, which leads to simpler functions which obviously ultimately helps with the issues you identified.
I originally thought he was talking about taking apart other people’s code but I think he means your own computational problem, so it kind of is ‘top down design’ but of the solution components rather than of the problem. On-the-fly recognition of more re-usable components would be an alternate way of looking at it. It’s a criticism people sometimes throw at agile development, that without a grand-plan, people can’t modularised properly but if every function has one simple job and every large complex task is split into many small functions, you get a construction kit.