Skip to content

Instantly share code, notes, and snippets.

@alexgian
alexgian / S3-oop-tuples.R
Last active Sep 4, 2018
A trivial example of Sussman's up/down tuples in R (not recursive yet)
View S3-oop-tuples.R
# use R OOP (S3) to implement up/down tuples
# (as per GJS and SICM)
library(purrr)
# constructor
new_Struct <- function(stype , vec){
stopifnot(is.character(stype)) # enforce up | down
stopifnot(is.vector(vec))
structure(vec,class="Struct", type=stype)
@alexgian
alexgian / extra_slib_guile-2.2.patch
Last active Aug 3, 2018
Patch to allow SLIB to work under Guile 2.0 (from Chris Vine - 2.0 won't work for 2.2 - use as appropriate)
View extra_slib_guile-2.2.patch
;; extra patch for 2.2 from Chris Vine (the one below is not enough)
;; not tested yet
--- guile-2.init.20 2018-06-14 10:42:46.393772164 +0100
+++ guile-2.init 2018-06-14 10:43:51.672814892 +0100
@@ -171,8 +171,6 @@
provide
provided?))
-(define slib-module (current-module))
-
@alexgian
alexgian / poly.scm
Created Jun 14, 2018
JACAL's polynomial routines (Aubrey Jaffer-MIT)
View poly.scm
;; JACAL: Symbolic Mathematics System. -*-scheme-*-
;; Copyright 1989, 1990, 1991, 1992, 1993, 1995, 1997 Aubrey Jaffer.
;;
;; 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
@alexgian
alexgian / structures.rkt
Last active Jun 12, 2018
Implements the up/down tuple structured objects used by scmutils/SICM, for Racket
View structures.rkt
#lang racket
(require
srfi/1
math
racket/struct
;; syntax stuff
(for-syntax
syntax/parse
syntax/parse/lib/function-header))
@alexgian
alexgian / simply_redef.scm
Last active Sep 29, 2020
Allows the code in the book "Simply Scheme" to run on Racket.
View simply_redef.scm
#lang scheme/base
;;; ============================================================================
;;; Port of the "Simply Scheme" book code to allow use under Racket
;;; ============================================================================
;;; It allows re-defining of module functions, which was the main obstacle
;;; to its operation previously.
;;; The first part is an adaptation of the necessary changes to run on Racket
;;; by importing aliased existing module functions using "require" and "only-in"
;;; The second part is the (slightly adapted) code from
You can’t perform that action at this time.