“Paper late!” cried a voice in the crowd,
“Old man dies!” The note he left was signed,
‘Old Kiczales’ - it seems he’s drowned!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(declaim (optimize (speed 3) (safety 1))) | |
(defconstant +pearl-probability+ (float 20/423)) | |
(declaim (inline trade)) | |
(defun trade () | |
(if (< (random 1.0) +pearl-probability+) | |
;; Note that RANDOM returns a value in [0, maximum), i.e. | |
;; it will only produce numbers below the maximum given. | |
(+ 4 (random 5)) | |
0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROJECTS=${1:-~/quicklisp/local-projects} | |
clone() { | |
TARGET=$PROJECTS/$(basename $1) | |
if [[ -d $TARGET ]]; then | |
(cd $TARGET; git pull) | |
else | |
git clone $1 $TARGET |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defpackage cas-word | |
(:use :cl) | |
(:export #:word-ref #:run-tests)) | |
(in-package :sb-vm) | |
(sb-c:defknown cas-word::%cas-word | |
((simple-array (unsigned-byte 64) 1) fixnum (unsigned-byte 64) (unsigned-byte 64)) | |
(unsigned-byte 64) | |
() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defclass point () | |
((x :initarg :x | |
:reader x | |
:type single-float | |
:pool-name *point-xs*) | |
(y :initarg :y | |
:reader y | |
:type single-float | |
:pool-name *point-ys*)) | |
(:metaclass pooled-class)) |
Note that only the C "control" example has type information; every other implementation either uses inference or generic arithmetic.
Implementation | Language | Time (ms) | Time rel. C | Arithmetic | Compilation model |
---|---|---|---|---|---|
GCC | C | 20.3 | 1 | mod 2^n | AOT |
SBCL | Common Lisp | 36.4 | 1.79 | bignum | AOT |
SpiderMonkey | JavaScript | 56.0 | 2.75 | float | JIT |
Chez | Scheme | 93.7 | 4.62 | bignum | AOT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun char- (character offset) | |
(- (char-code character) offset)) | |
(defconstant +encode-shift-lut+ | |
(sse:setr-pi8 | |
(char- #\a 26) #1=(char- #\0 52) #1# #1# #1# #1# | |
#1# #1# #1# #1# #1# (char- #\+ 62) | |
(char- #\/ 63) (char-code #\A) 0 0)) | |
(declaim (inline encode-lookup)) |
I feel somewhat pressed to give a negative review of this book. This comes from someone who has worked on various Lisp implementations, and written some amount of C, but that isn’t an excuse to be overly harsh. This book, however, does not provide many nice things to say, and plenty of un-nice things. My apologies in advance.
First off: God help you if you are going to write your first interpreter in C of all things. No one I know thinks it’s a good idea to start
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------- MODULE sicl_rack_update -------------------------- | |
EXTENDS Naturals, TLC | |
(* --algorithm basic | |
variables object = <<0, 0>>; | |
process ChangeClass \in 1..4 | |
variables oldclass = 0, oldrack = 0; | |
begin | |
LoadClass: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Remove any assignment instructions and locations which appear to | |
;;; be redundant. We define a "redundant" assignment to be one which | |
;;; assigns from a lexical location to another, either with only one | |
;;; defining instruction; i.e. the assignment does not cause any | |
;;; visible effect. | |
(defun remove-redundant-assignments (enter-instruction) | |
(cleavir-ir:map-instructions-arbitrary-order | |
(lambda (instruction) | |
(when (typep instruction 'cleavir-ir:assignment-instruction) |