Skip to content

Instantly share code, notes, and snippets.

Edwin Watkeys edw

Block or report user

Report or block edw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@edw
edw / euler.clj
Last active Sep 3, 2019
Problem 61 solution.
View euler.clj
;;; Solution to https://projecteuler.net/problem=61
(defn quadratic-formula [a b c]
(let [x (Math/sqrt (- (* b b) (* 4 a c)))]
(set [(/ (+ (* -1 b) x) (* 2 a))
(/ (- (* -1 b) x) (* 2 a))])))
(defn whole-number? [n]
(when (and (number? n)
(== (Math/round n) n))
@edw
edw / init.el
Created Apr 4, 2019
Recent Emacs Dotfile Finds
View init.el
(add-hook 'before-save-hook 'whitespace-cleanup)
(defun smart-open-line-above ()
"Insert an empty line above the current line.
Position the cursor at it's beginning, according to the current mode."
(interactive)
(move-beginning-of-line nil)
(newline-and-indent)
(forward-line -1)
(indent-according-to-mode))
@edw
edw / gerbil-index-transcript.md
Created Dec 22, 2018
Gerbil Index Transcript
View gerbil-index-transcript.md
> (load "/Users/edw/dev/i7t/thunknyc/names/index.ss")
"/Users/edw/dev/i7t/thunknyc/names/index.ss"
> (def e (all-exports))
> (hash-ref e 'display)
((gerbil/compiler/ssxi (imported syntax))
 (gerbil/core (imported syntax))
 (scheme/r5rs (imported syntax))
 (scheme/write (imported syntax))
 (std/parser/grammar (imported syntax)))
View gerbil-cookbook.md

In Gerbil Scheme, how do I …

Import R7RS libraries?

In the root of the directory structure that contains your libraries:

$ cat > gerbil.pkg
(prelude: :scheme/r7rs)
^D
@edw
edw / bad.scm
Created Dec 19, 2018
Bad(?) record
View bad.scm
(define-library (example bad)
(export Bad bad)
(import (scheme base))
(begin (define-record-type Bad
(make-bad a)
bad?
(a bad-a))
(define (bad a)
(make-bad a))))
@edw
edw / i7t.scm
Last active Dec 13, 2018
Incrément: A Scheme based on an enhanced EDN-like reader
View i7t.scm
;; Incrément: A Scheme based on an enhanced EDN-like reader
;;
;; Edwin Watkeys, Thunk NYC Corp.
;; <edw@poseur.com>
;; 13 December 2018
;; http://github.com/thunknyc/i7t
;;
(import (scheme red)
@edw
edw / sample.md
Last active Dec 11, 2018
Sketch of how Scheme might be adapted to enhanced, Clojure-style reader
View sample.md

Sketch of how Scheme might be adapted to enhanced, Clojure-style reader

Multiple procedure arities

;; Clojure
(defn add
  ([] 0)
  ([x] x)
  ([x y] (+ x y))
@edw
edw / rest-args.scm
Created Dec 1, 2018
Poking Scheme implementations' rest-arg handling bits
View rest-args.scm
(define (evil . args)
(set-cdr! args '())
args)
(let ((xs '(0 1 2 3)))
(display (apply evil xs))
(newline)
(display xs)
(newline))
@edw
edw / straw-poll.md
Last active Nov 29, 2018
Orange straw poll notes
View straw-poll.md

Orange straw poll notes

Edwin Watkeys
2018-11-28

Tallys and Histograms

I wrote a tally in Clojure for my profiling library. I'm interested helping out with this.

Integer sets

You can’t perform that action at this time.