Skip to content

Instantly share code, notes, and snippets.

$ grep -E '[[=é=]]'
grep: illegal option -- E
Usage: grep -hblcnsviw pattern file . . .
$ uname -a
SunOS sunray3 5.10 Generic_137111-07 sun4v sparc SUNW,Sun-Fire-T1000
(define-class <beast> () ())
(define-class <cat> <beast> (=^.^=))
(define-class <neko> <cat> ())
(define-class <dog> <beast> ())
(define speak (make-generic-function))
(add-method! speak (make-method '(speak (beast <beast>))
()
(list <beast>)
(lambda (beast)
(define-class <beast> () ())
(define-class <cat> <beast> (= ^ o ^ =))
(define-class <neko> <cat> ())
(define-class <dog> <beast> ())
(define-class <silver> <cat> (mii-chan))
(define speak (make-generic-function 'speak))
(add-method! speak (make-method '(speak (beast <beast>))
()
(list <beast>)
keycode 0x12 = 9 bracketleft iacute 9 braceleft dead_acute
keycode 0x13 = 0 bracketright eacute 0 braceright dead_doubleacute
keycode 0x22 = parenleft braceleft uacute slash bracketleft division
keycode 0x23 = parenright braceright parenright parenleft bracketright multiply
]=> (define-package :foo)
#<package 0x12e9fc0 >
]=> (in-package :foo)
#<package 0x12e9fc0 >
]=> +
debugger invoked on error:
Unbound variable
:object: (+ . #<environment 0x12b3f30 >)
trace buffer:
#!/usr/bin/env dfsch-repl
;; If we list all the natural numbers below 10 that are multiples of 3 or
;; 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
;; Find the sum of all the multiples of 3 or 5 below 1000.
(define (iota n)
(if (= n 0)
()
(cons n (iota (- n 1)))))
;; Each new term in the Fibonacci sequence is generated by adding the
;; previous two terms. By starting with 1 and 2, the first 10 terms will
;; be:
;; 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
;; Find the sum of all the even-valued terms in the sequence which do not
;; exceed four million.
(define (filter-stream fn stream)
;; What is the greatest product of four adjacent numbers in any
;; direction (up, down, left, right, or diagonally) in the 20×20 grid?
(define grid
#(#( 8 2 22 97 38 15 0 40 0 75 4 5 7 78 52 12 50 77 91 8)
#(49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 4 56 62 0)
#(81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 3 49 13 36 65)
#(52 70 95 23 4 60 11 42 69 24 68 56 1 32 56 71 37 2 36 91)
#(22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80)
#(24 47 32 60 99 3 45 2 44 75 33 53 78 36 84 20 35 17 12 50)
;; The following iterative sequence is defined for the set of positive
;; integers:
;; n → n/2 (n is even)
;; n → 3n + 1 (n is odd)
;; Using the rule above and starting with 13, we generate the following
;; sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
;; It can be seen that this sequence (starting at 13 and finishing at 1)
(require :socket-port)
(define (gopher-fetch host path)
(let ((conn (tcp-connect host 70)))
(port-write-buf (string-append path "\r\n") conn)
(port-read-whole conn)))