# Code Snippets Scheme

Short texts Scheme 🧑‍💻 Code snippets Scheme ✍️ Reading lists Scheme 👀

## SPSS Syntax for Scatterplot of Frequencies

* I’m not a regular SPSS user, but I found myself needing to generate a scatter plot of the frequency distribution of a variable, * i.e., what would normally be displayed as a histogram. Since I couldn’t find an easy way to accomplish this, here’s some * rather convoluted syntaxk. I would hope that there […]

## let-syntax.ss

; (import (scheme base)) (define (f a) (+ a 1)) (display (f 0)) (newline) (let ((f (lambda (a) (+ a 2)))) (display (f 0)) (newline) (let-syntax ((f (er-macro-transformer (lambda (form rename compare) `(,(rename ‘+) ,(cadr form) 3))))) (display (f 0)) (newline) (let ((f (lambda (a) (+ a 4)))) (display (f 0)) (newline))))

## church.scm

;;; church.scm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Composition helper functions ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define compose (lambda (f g) (lambda (x) (f (g x))))) (define compose-n (lambda (f n) (if (= n 1) f (compose f (compose-n f (- n 1)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Helper functions for lambda calculus. ;; ;; For our purposes here, the lambda calculus is […]

## vis.scm

;;; AST (define-class () ()) (define-class () ((value :init-keyword :value))) (define-class () ((lhs :init-keyword :lhs) (rhs :init-keyword :rhs) )) (define-class () ((lhs :init-keyword :lhs) (rhs :init-keyword :rhs) )) ;;; lispify – convert to lispy expression (define-class () ((stack :init-keyword :stack))) (define-method visit ((v ) (e )) (push! (slot-ref v ‘stack) (slot-ref e ‘value))) (define-method visit […]

## symbolicnotes.scm via https://github.com/Futrell/6.945/blob/master/symbolicnotes.scm

;;; 2-7-14 ;;; We use LISP because it is easy to demonstrate certain things. ;;; It is dangerous; we are interested in dangerous programming. (define (compose f g) (lambda (x) (f (g x)))) (define (identity x) x) (define (iterate f n) (if (= n 0) identity (compose f (iterate f (- n 1))))) (define (map […]