Clojure Cheat Sheet



Once again, my plan for the rest of my life is undergoing some revision.

My plan a week ago was to put 4Clojure on hold. I have tried it a few times and just wind up randomly scanning the Clojure cheat sheet for whatever function will get all the sub-problems to work. My plan was to just go through the Clojure cheat sheet and try out each and every function so I am at least a tiny bit familiar with them all.

If you need help with specific forms used, the Clojure Community Documentation is extremely helpful, especially the Clojure Cheat Sheet. It may be helpful to give the boot readme and wiki documentation a read. If you have questions about boot, IRC is a great way to get boot and clojure. Cheatsheet Clojure 1.10 Cheat Sheet (v49) Download PDF version / Source repo. Many thanks to Steve Tayon for creating it and Andy Fingerhut for ongoing maintenance.

Then I went to Austin Clojure last week. The speaker was Alex Miller who works on Clojure at Cognitect. He went over transducers. I understood it while I was there, but a week later it’s a bit fuzzy. A few things I think I remember: They do not give you any speed benefit unless you have large collections. But you should avoid them if you are using a function that returns a lazy sequence or an infinite sequence, like range.

Also: I should go through all Clojure code I have and ensure that all uses of reduce supply the “val” argument. Apparently the guys at Cognitect prefer that version.

Then someone mentioned 4Clojure. A few people mentioned that the difficulty curve shifts pretty suddenly, so I did not feel too stupid. Then Alex Miller said he never finished all the 4Clojure problems. So I thought that maybe I should learn Clojure and Lisp another way.

Clojure Cider Cheat Sheet

I know this might put off my Clojure/Lisp enlightenment, and probably delay any Clojure/Lisp employment, but I am thinking about trying Racket and going through Realm Of Racket. It is based on Scheme, and bills itself as a Scheme “with batteries included”.

Cheat

Scheme is intended as a teaching language, so the standard is intentionally small. So Scheme implementations have to fill in a lot of gaps to be useful in production. Which holds back industry adoption. Racket decided to break with Scheme standards and do its own thing to be more useful.

Racket claims to be a “programmable programming language” (but that seems to be true of all Lisps). I have glanced at a few parts of Realm Of Racket, and various web pages and articles and parts of videos, and from what I gather some programmers have used Racket to implement other languages in Racket. Including some versions of Scheme.

Which brings me to the next phase of My Plan To Be The Smartest Person Ever.

Clojure Cheat Sheet 2020

After Realm Of Racket, I might go through a few other Scheme books. One I found is Simply Scheme. That is intended as a prequel to the granddaddy of them all: Structure and Interpretation of Computer Programs (see pages on MIT site here and here, as well as pages by Andres Raba here, here and here). Paul Graham wrote that Lisp can make you smarter. Eric Raymond wrote that it will bring you to enlightenment. Many people point to SICP in particular as broadening people’s minds and expanding their understanding (see this page on Quora, this post by Not My Uncle Bob and Why SICP Matters at Berkeley).

But wait, there is more. Daniel P. Friedman of Indiana University wrote a few books on Scheme (a few of which he co-wrote with Matthias Felleisen, one of the creators of Racket): The Little Schemer (1996), The Seasoned Schemer (1996), The Reasoned Schemer (2005) and The Little Prover (2015) (which I think also uses Scheme).

Julian Gamble went through these (and a few Common Lisp classics as well) and did the exercises in Clojure. A noble effort, but I think the best thing might be do suck it up and learn some Scheme and go through the books in Scheme. You would need to work through them in the original Scheme or Common Lisp to redo them in Clojure, so why not learn Scheme? As Chancellor Gorkon pointed out, the only way to truly understand Shakespeare is to read him in the original Klingon.

Scheme is a lot older than Clojure, so for right now there is nothing in Clojure that people can point to and say, “Read this and you will become a much better programmer”. Julian Gamble’s site is the exception, but it seems like a lot of people have tried to go through these books in Clojure, and they never finish or the sites get abandoned. http://sicpinclojure.com/ is one example.

Maybe I will get through Realm Of Racket and decide to change my mind again. Who knows? A lot of this stuff has been on my vaporous to-do list for a while.

You’re welcome.

I have been writing a lot of my own IBMi diagnostic tools lately using Clojure and ClojureScript.

One of the problems I often encounter is needing to track down some data without having a great understanding of the tables and data I am querying.. So I built this tool to help me build queries.

When I select a machine, it selects a default schema and gives me a list of all possible tables. I select a table and press 'Get Sample' and it fetches me the 'Select * FROM table Limit 5' and displays the results. This is very helpful in that I can see the field names as well the format used for the data in each field. Sometimes my 5 samples don't give me enough information. Perhaps all five samples have the same value in a field or no value at all. I added a sample button in each row to help me with this case. When it is pressed, it fetches me the first five 5 distinct values from that field. Does this customer use this field at all? Is it what I think it is? Answers are often a click away.

Clojure Cheat Sheet Excel

At the bottom of the sample, I have a textbox in which I can type a SQL query. It's much easier now that I have a dynamically generated cheat sheet that gives me hints for any table.

It is already very helpful. Questions like 'what date format' are no longer guesswork.

Clojure Cheat Sheets

I plan to enhance it by having it suggest joins for me. I also plan to have it save queries for future use, and have it suggest those queries when a particular table is selected. I may add full interactive SQL capabilities to it. Time will tell.