This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cons () { | |
eval CAR"$CNUM"="$1"; eval CDR"$CNUM"="$2"; | |
CONSR="$CNUM.conscell"; CNUM="$((CNUM+1))"; | |
} | |
car () { eval CARR="\$CAR${1%%.conscell}"; } | |
cdr () { eval CDRR="\$CDR${1%%.conscell}"; } | |
TRUE=1; FALSE=0; NULL="empty"; | |
pairp () { | |
case "$1" in (*.conscell) PAIRPR="$TRUE" ;; (*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; referense | |
;;;; SLIB 3b1-5 | |
;;;; Gauche 0.9.11 | |
;;;; MIT/GNU Scheme 11.2 | |
(define (reduce-right f ridentity ls) | |
(if (null? ls) ridentity | |
(let loop ((ridentity (car ls)) (ls (cdr ls))) | |
(if (null? ls) ridentity | |
(f ridentity (loop (car ls) (cdr ls))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cond-expand | |
(gauche (import (gauche base) (scheme base) (scheme write))) | |
(guile (import (srfi srfi-1))) | |
(chibi (import (srfi 1) (scheme small)))) | |
(define (f x y) (list (list (+ (* (caar x) (caar y)) | |
(* (cadar x) (caadr y))) | |
(+ (* (caar x) (cadar y)) | |
(* (cadar x) (cadadr y)))) | |
(list (+ (* (caadr x) (caar y)) |
NewerOlder