here you goThings I’ve made, read and saved — shared here.

Archive

9,565 entries: 46 from X, 8,923 from Pinboard, saved 1998 to 2026.

Browse by tag, site, author, folder or language

Tags

Sites

Authors

Folders

Languages

Showing 1–50 of 101#lisp ×

2025

Emacs Lisp

Emacs Lisp Elements by Protesilaos Stavrou is a book about the emacs lisp Programming Language.

Prot - the author - is a pretty incredible guy. He maintains a bunch of nice Emacs packages and themes.

But maybe even more remarkable: he got kicked out of his flat in Greece, couldn't afford a new place, bought a small plot of land in the mountains and started building a hut from materials he was able to afford or from things neighbours gave him. Really the bare minimum (he often sat in his hut with a jacket in winter cause it wasn't well isolated/heated)

Absolutely inspiration, all documented on his YouTube channel https://youtube.com/@protesilaos?si=MnjV7MhKtsT5RDSM -- via Hacker News

notes#emacs#emacs-lisp#lisp

Church Of Turing - The Landscape of Lisp

churchofturing.github.io

Tl;dr:

  • If you want a minimalist, elegant Lisp with a strong academic foundation: choose Scheme.
  • If you want a powerful, batteries-included Lisp with a rich standard library and decades of history: choose Common Lisp.
  • If you want a modern Lisp with functional programming, concurrency, and JVM interop: choose Clojure.
  • If you want a beginner-friendly Lisp with great tooling and a focus on education and extensibility: choose Racket.

2022

2021

2020

onlisp

To fix Paul Graham's On Lisp for printing at Lulu.com, I had to fix the embedded fonts:

gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
 -sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer \
 -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true \
 -dEmbedAllFonts=true -sOutputFile=onlisp-fonts-embedded.pdf -f onlisp.pdf

The resulting files:

$ ls -l onlisp*
-rw-r--r--@ 1 pradeep  pradeep  1253063 Jun  6 17:35 onlisp-fonts-embedded.pdf
-rw-rw-rw-@ 1 pradeep  pradeep  1030575 Jun  6 15:38 onlisp.pdf

notes#lisp

Common Lisp

Why

Why I Chose Common Lisp — Dan's Musings; Jan 2025.

Core

Learning

If you are a beginner to CL, this challenge will help you to get started with setting up a development environment from scratch and begin the journey of learning CL together with other community members.

Reading /practicing CL programming

Scripting

Common Lisp as a Scripting Language, 2015 edition - Cybernethics / Cybernéthique — LiveJournal

Install cl-launch:

git clone https://gitlab.common-lisp.net/xcvb/cl-launch.git
cd cl-launch
make
make install
which cl
/usr/local/bin/cl

Example script -- cllaunch1.lsp:

#!/usr/bin/cl -sp lisp-stripper -E main
(defun main (argv)
  (if argv
      (map () 'print-loc-count argv)
      (print-loc-count *standard-input*)))

Run it: chmod +x cllaunch1.lsp

Fails with: Component "lisp-stripper" not found, required by #<SYSTEM "cl-launch-build-0">

To fix this, i cloned https://github.com/fare/lisp-stripper to ~/common-lisp, and the above problem goes away. Next it fails to find cl-ppcre.

I do remember installing it using quicklisp -- ls ~/quicklisp/dists/quicklisp/software/cl-ppcre-20190521-git.

Distributing CL binaries

Links

Common Lisp Books

Blogs

Projects

Fairly recent Common Lisp project that is not just a web application etc., -- https://github.com/atgreen/red-light-green-light -- "A git-centric policy management and enforcement tool designed to accelerate your CI/CD pipelines."

Opusmodus -- "Music Composition System"

Opusmodus revolutionizes music composition, fuses traditional notation with modern concepts, and streamlines the path to a finalized score.

Editing

notes#lisp#programming-language

Clojure programming language

Clojure is a Lisp that runs on the Java Virtual Machine (JVM).

Learning resources

Clojure as a Lisp

Courseware

Presentations

Clojure like languages

IDE and infrastructure

  • Lightmod -- Lightmod is a tightly integrated tool for making full stack Clojure and ClojureScript web apps. It is fully self-contained -- no need to install the JDK or any build tool. It hot reloads both client and server code automatically with zero setup.

  • Nightlight is an editor you run inside your Clojure projects. Instead of being a separate application like traditional editors and IDEs, it's just a library that you add to your project. It spins up a web server and provides a completely browser-based interface to edit your code.

  • CIDER is the successor to nrepl.

  • Cursive Clojure IDE -- is an IDE built on IntelliJ

  • Parinfer

REPL

online playgrounds

Getting started with Lighttable

Via

Basic instructions. I use cmd for the shortcuts below, substitute ctrl on non-mac platforms.

  1. Install Leiningen http://leiningen.org/ you do not need to install clojure, lein will grab clojure for you.
  2. lein new playground from the command line to create a 'playground' project
  3. Open Light Table
  4. ctrl-space woto for "Toggle Workspace tree"
  5. Add the playground project folder you just created
  6. cmd-o core.clj to open the main clojure file for the project
  7. On an empty line type (+ 1 1) and hit cmd-enter

Things will grind away for a while as all the dependencies are downloaded and the JVM starts up. Get a cup of coffee or something. Eventually you'll see a green 2 show up.

You can then type anything in the tutorial and hit cmd-enter to evaluate it or cmd-shift-enter to evaluate the entire file. Think of the file as a shell with an editable history instead of something you'd want to commit to source control.

Documentation is searchable via ctrl-shift-d or moving your cursor on top of a function name and hitting ctrl-d. Autocomplete is available on tab, you can jump to definition with cmd-. and back with cmd-,

TODO: Explore CIDER + AC(autocomplete) + ritz.

Applications

Libraries

Spec

the biggest win from spec has been with parsing. This completely changes how you'd write a library that takes a data structure and parses it into something meaningful (for example, what hiccup does for html or what honeysql does for sql). In the past, this required a lot of very ugly parsing code and manual error-checking. With spec, you write specs and call s/conform. If it failed, you get a nice error, especially if you pair it with expound. If it succeeded, you get a destructured value that is really easy to pull data out of. I've done this in a half dozen different libraries and i'm pretty sure i wouldn't have even written them without spec.

Mallimalli and specmonstahspecmonstah are my favourite Clojure(Script) libraries built on top of Clojure Spec.

Clojure books

The first chapter, Names, explains why names define the structure of our software, and how to judge whether a name is any good.

The second chapter, Idioms, provides specific, syntactic advice for writing Clojure which is clean and readable.

The third chapter, Indirection, looks at how code can made simpler and more robust through separation.

The final chapter, Composition, explores how the constituent pieces of our code can be combined into an effective whole.

Clojurescript books

Experience reports and discussions

Articles

Talks and presentations

Tips and tricks

Cool projects / Read Code

Visualization / Notebook

Web development

Big data

Blogs

ClojureScript

Graal

  • This nextjournal notebook has a recipe for building Babashka "executing Clojure snippets or scripts in the same space where you would use Bash."

Web development

PCP

alekcz/pcp: PCP: Clojure Processor -- Like drugs but better

Just use it like PHP on a webserver (say nginx):

    #new pcp config => change .php to .clj
    index index.clj index.html index.htm;
    #new pcp config => change .php to .clj
    location ~ \.clj$ {
        #default nginx config on digital ocean lemp image
        #include snippets/fastcgi-php.conf;
        #fastcgi_pass unix:/run/php/php7.0-fpm.sock;

        include scgi_params;
        scgi_intercept_errors on;
        scgi_pass   127.0.0.1:9000;
    }

PCP has following libraries built in:

(require  '[cheshire.core :as json]
      '[clostache.parser :as clo]
      '[selmer.parser :as parser]
      '[selmer.filters :as filters]
      '[clj-http.lite.client :as client]
      '[next.jdbc :as jdbc]
      '[honeysql.core :as sql]
      '[honeysql.helpers :as helpers]
      '[postal.core :as email]
      '[clojurewerkz.scrypt.core :as sc])

Learning Journal

  • this is a good demo of how to use Clojure's -Sdeps at the command line to execute a script (even one hosted remotely on git):
clojure -Sdeps '{:deps
    {hello-clojure
        {:git/url "https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202"
        :sha "1c9a05106171f97f9b8e8ac8f58c7bd8dbe021f9"}}}'
    -m hello-clojure

See also: lisp, scheme.

notes#clojure#jvm#lisp#programming-language

Emacs Notes

This page is a journal of my experiments with emacs. In November of 2008, I decided to use emacs for all my text editing purposes, after long been convinced of Emacs's power and utility in editing programs and texts. At this time, I consider myself to be an adequate user of vim, emacs and TextMate. My goal is to teach myself emacs in an auto-didactic manner and make a note of the questions I had and the solutions I found for them. I hope this serves as a reminder for myself on a later date.

Note: All the instructions on this page, unless otherwise noted, are tested on Mac OS X systems and Aquamacs.

Python + Emacs

Install rope, ropemode, pep8 and pyflakes.

$ pip install ropemode pep8 pyflakes

Install yasnippet-bundle and pymacs in emacs:

M-x package-install yasnippet-bundle

References:

Emacs Client on Mac OS X

Here is a nice AppleScript created by Brian McCallister that provides proper emacsclient behaviour. Update: this script launches a "terminal" window, which is an annoyance.

Navigation

Go to Shortcut


Goto line M-gg. End of the buffer M-x > End of the line C-e Beginning of the line C-a

Editing

Do what Shortcut


zap-to-char (say e) M-z e merge multiple lines M-^ (alt-shift-6)

Customising emacs

Customizing emacs is done through editing ~/.emacs file. Though, if you are using emacs-starter-kit you will be putting files under emacs.d.

Adding a new key binding.

You can bind any operation that you can do in emacs to a set of key strokes. For example: the emacs-git integration -- magit can be invoked by typing M-x magit-status. But, this gets tiring after a while, so you may want to assign a short cut. Short cuts in Emacs start with 'C-c'. You have to decide what comes after C-c. In this case, I chose magit-status.

Add the following lines to your .emacs file:

;; C-c ms Magit-status
(global-set-key (kbd "C-c ms") 'magit-status)

The first line is the comment (a good practice) and the second line tells emacs to call magit-status when you press C-c ms.

After editing a custom function in .emacs file how do I reload it?

Select the block of code that you want to reload and hit C-x C-e (evaluate). This can also be achieved by positioning the cursor (point in emacs lingo) after the last closing parentheses of the function and typing C-x C-e.

Editing ConTEXt files with Emacs

Install ConTEXt. Install AUCTEX using port (on mac).

$ sudo port install auctex

Active AucTEX by putting this (load "auctex.el" nil t t) in .emacs.

Auto completion.

Install YASnippet to get auto-completion on emacs. To use YASnippet, type in the trigger word and press TAB. For example, typing def and pressing TAB will give you

    def name():
        """
        """

The next tab press allows you replace the default function name with your own, with subsequent tabs taking you to the parameter list, docstring and finally the body of the function

What programming font?

This page has a nice collection of free programming fonts optimized for editing code over long durations of code. The rule of thumb to remember while selecting a programming font is: it should be a fixed width font. This is especially true in languages like "Python":Python where indentation is essential in understanding the code flow.

I currently use Monaco, a font that is available on Mac OS X set to size 10.

Emacs Muse Notes

Muse tutorial.

Instead of editing the muse-latex.el and muse-book.el files, just use customize on the muse-latex-header and muse-book-latex-header variables. Upgrades to new versions of muse will be much smoother.

Emacs + Git integration

Main entry point M-x magit-status (bound to C-c ms). Go to the magit buffer *magit: PRJNAME* and press tab on the line containing the filenames. The modified text will expand underneath. Press TAB again collapse.

Press g in the magit buffer to refresh git status. or execute M-x magit-status from one of the repository files.

Removing trailing white spaces

The emacs manual defines tells us that setting buffer variable show-trailing-whitespace to t will show trailing white spaces.

(setq show-trailing-whitespace 't)

Paste the above line into the current emacs buffer and evaluate the statement by pressing C-x C-e. Delete the white spaces with M-x delete-trailing-whitespace

Check to see if your emacs configuration is correct.

Source

emacs -q --eval '(condition-case err (progn (load "~/.emacs") (kill-emacs 0)) (error (kill-emacs 1)))'

Shut down emacs gracefully from the command line

emacsclient -n -e '(kill-emacs)'

How to ? Command


Create a Directory from within emacs M-x make-direct ory

[Spell M-x ispell check](http://www.gnu.org/software/emacs/manual/html_no de/emacs/Spelling.html)

Undo C-x u or C-_

Describe key C-h k

Describe bindings C-h b

Describe functions C-h f

Emacs Server/Client

See Running emacs as daemon.

Setting up SLIME

Movie showing how to setup slime, swank, sbcl and emacs

Some notes:

check out slime and put it somewhere convenient, ie., $HOME/elisp/slime.

Put the following lines in .sbclrc

(require :asdf)
(push "/Users/pradeep/elisp/slime/" asdf:*central-registry*)

Load swank in sbcl:

$ sbcl
(asdf:oos 'asdf:load-op :swank)
(setf swank:*use-dedicated-output-stream* nil)
(setf swank:*communication-style* :fd-handler)
(swank:create-server :dont-close t)

Installing emacs24

What's new in emacs 24?

git clone git://git.savannah.gnu.org/emacs.git
cd emacs
sudo apt-get install libxpm-dev
sudo apt-get install libgif-dev
sudo apt-get install libtiff-dev
./configure
make
sudo make install

My initial impression of emacs24 is that it feels much faster compared to the stock emacs-snapshot available on ubuntu maverick.

Understanding Emacs

Essays on Emacs

Interesting modes

Help

Interesting reads

Dotemacs

Distributions

Packages

Information well / emacs people

TODO

Is it possible to show the keybindings in the modeline?

Use case: I have configured 'Fn' keys for mode specific actions, but do not remember them, or I want emacs to prompt me to use them.

Starting point: http://www.emacswiki.org/emacs/ModeLineConfiguration

Random tips

  • Use M-x new-frame create a new Emacs window associated with the current Emacs instance. Great for organising, or when running Emacs on a multi monitor setup!

CIDER

Journal

Fri, January 3, 2020 : Trying out Swaroop's Rangoli-emacs

Sat, Jan 4, 2020 : if you see emacs ssl certificate problem error when installing a new dependency (zencoding-mode in my case), try to launch emacs from the terminal emacs -nw instead of the graphical mode. This finds the root certificates.

Thu, Jan 16, 2020 : settings up mac os x and iterm2 for emacs. what I want is to be able to:

1. on the laptop: use the `command` key as `option` and vice versa, so that it is similar to the "regular keyboard" (I use the Das Keyboards at work and home)
2. in ther iterm2 window, be able to use left-alt key as `meta`. so that when I type `left-alt-m` I get `Meta-m`.

notes#emacs#lisp#text-editor

Lisp

What makes lisp special?

Starting to code in Common Lisp

CL-References

Other Lisps

T

Urn

Urn is a Lisp that compiles to Lua. Its tutorial is one of the friendliest to learn Lisp itslef.

Picolisp

uLisp

  • uLisp -- Lisp for Arduino, Adafruit M4, Micro Bit, ESP8266/ESP32, and MSP430 boards.

Notes

To add readline support to the SBCL REPL, use rlwrap

Use quicklisp to discover, install and manager Lisp libraries

Starting SBCL with QuickLisp pre-loaded.

$ rlwrap sbcl --load ~/quicklisp/setup.lisp

Quotes

In C, you are writing assembly constructs disguised as a high level language. In lisp, you are writing compiler constructs (abstract syntax trees) disguised as a high level language. Assembly language targets hardware-oriented geeks. Lisp targets compiler-oriented geeks. Since the two don't (generally) understand the other's viewpoint, each hates the other's favorite language.

-- gvb at i hate lisp.

Implement your own Lisp

Links

Blogs

Videos

Algorithms

Lisp Machines

Books

IDEs

The de-facto IDE for most lisps in Emacs. Howver Portacle - A Portable Common Lisp Development Environment is a good, ready-to-go, purpose-built distribution of Eamcs for use on Windows, Mac and Linux.

Talks

People

Implementations

Distributions

Interesting programs / libraries

Tips

lisp tip: run visual programs with (uiop:run-program '("sudo" "htop") :output :interactive :input :interactive) works for sudo, vim, htop, ncdu… see also (cmd:cmd "sudo htop" :<> :interactive)

Discussions/ Comparisons

Understanding the words "package", "system", "project" .. which have different meanings than commonly understood ones.. As explained by sjl on lobste.rs:

Common Lisp’s terminology is confusing because it’s old and uses a lot of words that we use now (like “package”) to mean different things than people mean today. Things get easier once you internalize what Common Lisp means by the terms.

A package in Common Lisp is a container for symbols. They’re a way to group related names (symbols) together so you don’t have to do the miserable prefixing of every name with mylibrary-... like you do in Emacs Lisp or C to avoid name clashes.

Unlike other languages like Python/Clojure/etc, packages and files on the hard disk are not tied strongly together in Common Lisp. You can have several files that all work with the same package, a single file that switches back and forth between packages, or even write code that creates/mutates packages at runtime. Files and packages are orthogonal in Common Lisp, which gives you maximum flexibility to work however you want.

A system in Common Lisp is a collection of code (mostly) and a description of how to load that code (and some metadata like author, license, version, etc). For example: my directed graph library cl-digraph contains a system called cl-digraph. That system has a description of how to load the code, and that description lives in the cl-digraph.asd file. It creates a Common Lisp package (called digraph).

The Common Lisp language itself has no knowledge of systems. ASDF is a Common Lisp library bundled with most (all?) modern implementations that handles defining/loading systems. (The name stands for Another System Definition Facility, so as you might guess there have been several other such libraries. ASDF is the one everyone uses today.)

Systems and packages are orthogonal in Common Lisp. Some systems (like small libraries) will define exactly one package. Some systems will define multiple packages. Rarely a system might not define any new packages, but will use or add to an existing one.

A project in Common Lisp is not an official term defined anywhere that I know of, but is generally used to mean something like a library, a framework, an application, etc. It will usually define at least one system, because systems are where you define how to load the code, and if it didn’t define a system how would you know how to load the code? My cl-digraph library mentioned above is a project that defines three systems:

  • cl-digraph which contains the actual data structure and interface.
  • cl-digraph.test which contains the unit tests. This is a separate system because it lets users load the main code without also having to load the unit test framework if they’re not going to be running the tests.
  • cl-digraph.dot which contains code for drawing the directed graphs with Graphviz. This is a separate system because it lets users load the main code without also having to load the cl-dot system (the graphviz bindings) if they don’t care about drawing.

If I were writing this today I’d use ASDF’s foo/bar system naming notation instead of separating the names with a dot, because there’s some nice extra support for that. I just didn’t know about it at the time, and don’t want to break backwards compatibility now.

We saw how Common Lisp has no concept of a system — that comes from ASDF. Similarly, ASDF has no concept of the internet, or reaching out to somewhere to download things. It assumes you have somehow acquired the systems you want to load, maybe by sending a check to an address and receiving a copy of the code on floppy disk, as many of my old Lisp books offer in the back pages.

Quicklisp is another library that works on top of ASDF to provide the “download projects from the internet automatically if necessary” functionality that people want in our modern world. So when you say (ql:quickload :cl-digraph) you’re asking Quicklisp to download cl-digraph (and any dependencies) if necessary, and then hand it off to ASDF to actually load the code of the cl-digraph system. Unlike ASDF, Quicklisp is relatively new in the Common Lisp world (it’s only about eight years old) bundled with any modern Lisp implementations (that I know of) (yet?), which is why you need to install it separately.

So to summarize:

  • Files are files on your hard drive.
  • Packages are containers of symbols. They are orthogonal to files.
  • Systems are collections of code, plus instructions on how to load this code. They are orthogonal to packages.
  • Projects are high-level collections of… “stuff” (code, documentation, maybe some image assets, etc). They are (mostly) orthogonal to systems (seeing a trend here?).
  • Common Lisp knows about files and packages. ASDF adds systems. Quicklisp adds the internet.

This is a pretty high-level view that glosses over a lot, but maybe it’ll clear things up and help you dive into the details later.


notes#lisp#programming-language

Janet

Janet Programming Language is a Clojure like Lisp scripting language also suitable for embedding.

Why

Why Janet?; Apr 2023. Book "Janet for Mortals" by Ian Henry.

Learn

Notes

  • Project definitions go into a project.janet file.
  • Third party dependencies are defined like this: {:dependencies [{:repo "https://github.com/joy-framework/moondown" :tag "0.1.0"}]}

The structure of a project.janet file is: (See more here)

(declare-project
  :name "mylib" # required
  :description "a library that does things" # some example metadata.

  # Optional urls to git repositories that contain required artifacts.
  :dependencies ["https://github.com/janet-lang.json.git"])
  • See littleserver on how to build an executable from Janet source.

Cool projects in Janet

  • Bauble studio -- making art online with lisp(janet) and math.

  • Mendoza -- static website generator with a markdown language inspired by Scribble (of racket).

  • Tester -- testing framework. Readme file has an example of how to use fswatch to run the tests when files change.

  • Joy Framework -- a web framework for Janet.

    • jpm install joy.
    • has an ORM?
  • esv a web application built using Janet, (and circlet library).

Janet Shell

janetsh "A powerful new shell that uses the janet programming language for both the implementation and repl.". This is pretty cool when you want a regular shell that can do mundane things like ls -lart, but also use janet as a REPL and scripting language when you want to more advaned things without resolving to bash scripting. See this introductory article by the creator -- Andrew Chambers.

In this article, -- JSON in Janet Shell you can see how to use the ~/.janetsh.rc file to load additional modules (in this case ability to process JSON) to extend the capability of janetsh.

# Tell janet it can load janet and native modules from ~/janet-modules
(array/insert module/paths 0
   [(string (os/getenv "HOME") "/janet-modules/:all:.janet") :source]
   [(string (os/getenv "HOME") "/janet-modules/:all:.:native:") :native])

# copy combined dynamic library to janet-modules dir
cp build/json.so ~/janetsh-modules

# use it
$ (import json)
$ (var astronaut-in-space
    (json/decode ($$ curl http://api.open-notify.org/astros.json)))
# note: $$ appears to be the function call to invoke programs

# Print each one and the space craft they are in.
$ (each astronaut (astronauts-in-space "people")
    (print
      "Name: " (astronaut "name")
      ", Craft: " (astronaut "craft")))
...
Name: Oleg Kononenko, Craft: ISS
Name: David Saint-Jacques, Craft: ISS
Name: Anne McClain, Craft: ISS

This is a very nice capability (being able to extend the shell programming language).

notes#clojure#lisp#programming-language

Fennel programming language

Fennel is another clojure-like language that compiles down to lua created by Phil HagelBerg "technomancy".

Anywhere you can run Lua code, you can run Fennel code.

Phil Hagelberg/Technomancy has three.blog.posts about using Fennel to write a new game EXO_encounter that is hosted on itch.io (which itself is written by Lua-u* leafo).

Here is an introductory post on Fennel by Technomancy.

Software written using Fennel

*What's the demonym for a Lua programmer? (like Pythonista for Python programmers) -- Lua'r, Lua-oo?


See also: janet, lua

notes#clojure#lisp#lua#programming-language

2015

2011

New Computer Language Shootout? - comp.lang.lisp | Google Groups

groups.google.com

I'd rather work with a language that lets me say things as I want to
say them, and work to speed up the things that seem too slow where
that turns out to matter, than begin by tying my hands and saying the
only expressional paradigms I may consider are those that are known on
the day I start programming to be a particular speed.

2010

Creating a Wiki with UCW

common-lisp.net

This tutorial will show you how to create web applications with UnCommon Web (UCW). During this tutorial we will create two distinct, but functionaly similar, wikis. The first, "regular style," will be developed using the same mind set and organization as you would use with any other web framework (though it will use as much of UCW as possible). The second wiki, "UCW style," will be an idiomatic UCW application.