A beginner-friendly REPL that combines
#!/bin/sh | |
#_( | |
#_DEPS is same format as deps.edn. Multiline is okay. | |
DEPS=' | |
{:deps {clj-time {:mvn/version "0.14.2"}}} | |
' | |
#_You can put other options here | |
OPTS=' |
# Add these to your .bash_profile / .zshrc / etc. | |
# Starts a Clojure repl | |
function rebel-clj() { | |
clojure -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.4\"} $@}}" -m rebel-readline.main | |
} | |
# Starts a browser REPL | |
function rebel-cljs() { | |
clojure -Sdeps "{:deps {com.bhauman/figwheel-main {:mvn/version \"0.1.7\"} com.bhauman/rebel-readline-cljs {:mvn/version \"0.1.4\"} $@}}" -m figwheel.main |
{:paths ["."] | |
:deps {clansi/clansi {:mvn/version "1.0.0"}}} |
I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.
This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea
According to Jonathan Blow, an ambitious project (or "deep work" as he calls it) is something that changes you.[1] Afterwards you are better at what you do, not in an incremental way, but in a substantial and qualitative way, you become a unique specialist in your field.
Blow spent 3.5 years designing the game Braid, and it taught him small puzzle design. He spent 7 years designing the game The Witness, and learned how to create long arcs of rich, non-verbal communication through puzzles. These were
(ns text-xform | |
(:require [clojure.java.io :as io] | |
[clojure.string :as str] | |
[cheshire.core :as json]) | |
(:import [java.io BufferedReader])) | |
;;;; inspired by https://tech.grammarly.com/blog/building-etl-pipelines-with-clojure | |
(def db (atom 0)) |
#!/usr/bin/env lumo | |
(ns spacedl.spacedl | |
(:require [cljs.nodejs :as node] | |
[clojure.pprint :refer [pprint]] | |
[clojure.string :as string :refer [join split starts-with?]] | |
[cljs.core :refer [*command-line-args*]])) | |
(node/enable-util-print!) | |
(.on js/process "uncaughtException" #(js/console.error %)) |
;; differences from scheme unfold | |
;; even initial value is lazy | |
;; predicate sense reversed | |
;; internal state == produced value, no special mapper-fn | |
;; no tail-gen | |
(defn series | |
"Produces a sequence of values. | |
`f` is a function that given a value, returns the next value. | |
`continue?` is a predicate that determines whether to produce |
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
- The link in the table of content jumps at the copy of the answer on this page.
- The link on the answer itself points back at the original post.