Skip to content

Instantly share code, notes, and snippets.

View samth's full-sized avatar

Sam Tobin-Hochstadt samth

View GitHub Profile
;; 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)
#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/
#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" ""))
#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
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")))))
--- 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
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:
#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)
[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) {
.file "x.c"
.text
.section .rodata
.LC2:
.string "test = %20.20g\n"
.text
.globl main
.type main, @function
main:
.LFB0: