This file contains 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
/* | |
transpose_ij (10000x5000): gmemops=0.23, min=0.436734, avg=0.455368, relerr=3.42% | |
transpose_ji (10000x5000): gmemops=0.28, min=0.356635, avg=0.363628, relerr=2.55% | |
transpose_ij_ij (10000x5000): gmemops=1.53, min=0.065207, avg=0.069465, relerr=6.07% | |
transpose_rec1 (10000x5000): gmemops=1.44, min=0.069258, avg=0.075378, relerr=8.96% | |
transpose_rec2 (10000x5000): gmemops=1.37, min=0.072819, avg=0.079644, relerr=8.77% | |
transpose_ij (100000x100): gmemops=1.70, min=0.011731, avg=0.014102, relerr=9.99% | |
transpose_ji (100000x100): gmemops=0.23, min=0.086909, avg=0.095706, relerr=3.37% | |
transpose_ij_ij (100000x100): gmemops=1.73, min=0.011543, avg=0.013170, relerr=6.96% |
This file contains 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
; https://web.archive.org/web/20190701203222/https://www.pcengines.ch/tp3.htm | |
; The disassembler was applied to a copy of TP 3.01A downloaded from WinWorld. | |
; I postprocessed the disassembly with a script to clean up spacing and column alignment. | |
; *** TURBO PASCAL version 3.01 A source code | |
; *** | |
; *** commented by Pascal Dornier | |
; *** all rights reserved | |
; "*** | |
cseg $100 ; "COM file... |
This file contains 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
; Math48 Floating Point Package | |
; Version 1.1 Revision 1 | |
; by Anders Hejlsberg | |
; 2532 Bytes | |
;HOPTABEL | |
JP FPADD | |
JP FPSUB | |
JP FPMUL |
This file contains 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
#lang racket | |
(require redex) | |
;; Run to explore all of the gradual typings of the example | |
(define (main) | |
(traces -> (term example))) | |
(define-term example | |
(λ (x : ?) | |
(λ (y : ?) |
This file contains 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 FoldsAndUnfolds where | |
import Data.List -- for unfoldr | |
class Functor f => Recursive f t | t -> f where | |
project :: t -> f t | |
cata :: (f a -> a) -> t -> a | |
cata alg = go where go = alg . fmap go . project |
This file contains 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
#lang racket | |
;; An introduction to procedure inlining following a simplification of GHC's | |
;; inliner from: | |
;; https://www.microsoft.com/en-us/research/wp-content/uploads/2002/07/inline.pdf | |
;; | |
;; This version is a simplification in that: | |
;; 1. It picks loop breakers naively | |
;; 2. It ONLY inlines procedures (not other bound expressions) | |
;; 3. All calls are direct, so it's not context sensitive (although the |
This file contains 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
# Here's a probably-not-new data structure I discovered after implementing weight-balanced trees with | |
# amortized subtree rebuilds (e.g. http://jeffe.cs.illinois.edu/teaching/algorithms/notes/10-scapegoat-splay.pdf) | |
# and realizing it was silly to turn a subtree into a sorted array with an in-order traversal only as an | |
# aid in constructing a balanced subtree in linear time. Why not replace the subtree by the sorted array and | |
# use binary search when hitting that leaf array? Then you'd defer any splitting of the array until inserts and | |
# deletes hit that leaf array. Only in hindsight did I realize this is similar to the rope data structure for strings. | |
# Unlike ropes, it's a key-value search tree for arbitrary ordered keys. | |
# | |
# The main attraction of this data structure is its simplicity (on par with a standard weight-balanced tree) and that it | |
# coalesces subtrees into contiguous arrays, which reduces memory overhead and boosts the performance of in-order traversals |
This file contains 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
void parse_expr(Value *dest); | |
Sym *parse_ident(void) { | |
if (tok != TOK_IDENT) { | |
error("Expected identifier"); | |
} | |
Sym *ident = tok_sym; | |
next(); | |
return ident; | |
} |
This file contains 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
(** "Landin's Knot" - implements recursion by backpatching *) | |
let landins_knot f = | |
let r = ref (fun x -> assert false) in | |
let fixedpoint = f (fun x -> !r x) in | |
r := fixedpoint; | |
fixedpoint | |
let factorial = | |
let g f x = | |
if x = 0 then |
This file contains 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
#!/boot/bzImage | |
# Linux kernel userspace initialization code, translated to bash | |
# (Minus floppy disk handling, because seriously, it's 2017.) | |
# Not 100% accurate, but gives you a good idea of how kernel init works | |
# GPLv2, Copyright 2017 Hector Martin <marcan@marcan.st> | |
# Based on Linux 4.10-rc2. | |
# Note: pretend chroot is a builtin and affects the current process | |
# Note: kernel actually uses major/minor device numbers instead of device name |
OlderNewer