Skip to content

Instantly share code, notes, and snippets.

Avatar
🐧
Staying home

Sam Tobin-Hochstadt samth

🐧
Staying home
View GitHub Profile
View utils.rkt
#lang at-exp racket
(provide indented
link-file
campuswire-url campuswire campuswire-invite ; piazza-url piazza
zoom canvas
youtube watch-youtube
textbook
the-design-recipe
bslblock
first-day-of-break-week week
View exam4-rubric.rkt
;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname exam-solns) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
;; 23:11
; Problem 1
; A SplitTree is one of:
; - Number
; - (make-no-points)
View lab 1.rkt
#reader(lib"read.ss""wxme")WXME0109 ##
#|
This file uses the GRacket editor format.
Open this file in DrRacket version 7.7 or later to read it.
Most likely, it was created by saving a program in DrRacket,
and it probably contains a program with non-text elements
(such as images or comment boxes).
http://racket-lang.org/
View b.rkt
#lang racket
(define (convert.1 n)
(define pling (divides? 3 n))
(define plang (divides? 5 n))
(define plong (divides? 7 n))
(if (or pling plang plong)
(string-append (if pling "Pling" "")
(if plang "Plang" "")
(if plong "Plong" ""))
View racket-raytracer.rkt
#lang racket/base
;;; Copyright © 2020 Jakob L. Kreuze <zerodaysfordays@sdf.org>
;;;
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation; either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
View small_step.py
def step(expr):
(E,redex) = find_redex(expr)
if isinstance(redex, App):
if redex.op == "call/cc":
v = redex.arg
# E[(call/cc v)] -> E[(v (lambda (w) (abort E[w])))]
return plug(E, App(v, Lam("w", App("abort", plug(E, "w")))))
View gist:46dd2a719a5818da6591058de30e8e23
--- old.s 2020-04-21 11:07:00.527082284 -0400
+++ new.s 2020-04-21 11:06:43.331026298 -0400
@@ -1,71 +1,71 @@
+#if defined(__thumb__)
+#define RETURN(x) bx x
+#else
+#define RETURN(x) mov pc, x
+#endif
+
+ .align 3
View test.perf
racketcs 21845/21845 5184070.732380: 1 cycles:u:
7fc3fee4a100 [unknown] (/usr/lib/x86_64-linux-gnu/ld-2.30.so)
racketcs 21845/21845 5184070.732386: 1 cycles:u:
7fc3fee4a100 [unknown] (/usr/lib/x86_64-linux-gnu/ld-2.30.so)
racketcs 21845/21845 5184070.732390: 23 cycles:u:
7fc3fee4a100 [unknown] (/usr/lib/x86_64-linux-gnu/ld-2.30.so)
racketcs 21845/21845 5184070.732394: 746 cycles:u:
View fltester.rkt
#lang racket
(require math/bigfloat racket/flonum
math/private/flonum/flonum-functions
math/private/utils/flonum-tests
math/private/flonum/flonum-bits
math/private/flonum/flonum-constants)
(define-namespace-anchor ns)
View transcript
[samth@huor:~/.../math-test/math/tests (master) plt] cat x.c
/* pow example */
#include <stdio.h> /* printf */
#include <math.h> /* pow */
int main (int argc, char** argv)
{
double d = 1.4916681462400412e-154;
double x = -1.0;
if (argc > 5) {