Skip to content

Instantly share code, notes, and snippets.

View zot's full-sized avatar

Bill Burdick zot

  • Jerusalem, Israel
View GitHub Profile

What is Leisure?

Simply put, Leisure is a document-oriented, exploratory computing environment for what we call Illuminated Programming. Leisure documents are:

  • editable
  • collaborative
  • interactive
  • web-based (zero install)

Illuminated Programming is our term for application, source code, and data, all rolled up into one interactive, collboratively editable

@zot
zot / phi-search-kluge.el
Created September 10, 2013 19:52
kluge to clean up phi-search results in multiple-cursor mode
(defvar my-phi-search-counter 0)
(defvar my-mc-cleanup-counter 0)
(defadvice phi-search-complete (around my-phi-search-cleanup)
ad-do-it
(cl-incf my-phi-search-counter))
(defadvice mc/execute-command-for-all-fake-cursors (around my-mc/execute-command-for-fake-all-cursors)
ad-do-it
(if (< my-mc-cleanup-counter my-phi-search-counter)
@zot
zot / differenceLists.md
Last active September 17, 2017 01:07

Difference Lists

A difference list is really a layer on top of another data structure that you can use for cheap appending, later extracting the underlying data structure when you’re done with all the appending. It’s kind of like an array buffer or a string buffer and it’s very simple to implement. You can back a difference list with any data structure that allows you to add an item cheaply to the start or end.

Here are two examples, one using cons-lists in Clojure and one using tables in Lua. Appending two Clojure cons-lists and Lua tables is normally a O(n) operation, making it O(n^2) for appending multiple lists or tables. Difference lists let you append in O(1) and produce the final list or table in O(n), regardless of how many difference lists you’ve appended together.

One interesting thing about difference lists is that a difference list is really a function. Calling it with an argument extracts the backing list from the difference list by appending or prepending to the argument, so calling a