Skip to content

Instantly share code, notes, and snippets.

View BusFactor1Inc's full-sized avatar

BusFactor1 Inc. BusFactor1Inc

  • BusFactor1 Inc.
  • Canada
View GitHub Profile
@BusFactor1Inc
BusFactor1Inc / nock.lisp
Last active May 1, 2019 23:22 — forked from burtonsamograd/nock.lisp
A Nock Interpreter and Compiler in Common Lisp #Urbit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; nock.lisp - The Interpretation and Compilation of Nock Programs.
;;
;; Nock is the Maxwell's Equations of Software. It is a language that
;; powers the Urbit virtual machine; its specification can fit on a
;; t-shirt[1].
;;
;; In this set of Common Lisp functions below are 'tar',
;; a Nock interpreter, 'dao', a Nock compiler and 'phi',
;; a Nock compiler driver.
@BusFactor1Inc
BusFactor1Inc / nock.lisp
Created May 18, 2017 00:04 — forked from burtonsamograd/nock.lisp
A Nock Interpreter and Compiler in Common Lisp #Urbit
;; A nock interpreter
(defun tar (a f)
(labels ((fas (b a)
(declare (integer b))
(cond
((= b 1) a)
((= b 2) (car a))
((= b 3) (cdr a))
((evenp b) (car (fas (/ b 2) a)))
((oddp b) (cdr (fas (/ (1- (the integer b)) 2) a))))))