= Scheme == Resources "A Scheme Primer" https://spritely.institute/static/papers/scheme-primer.html Scheme Requests for Implementation https://srfi.schemers.org/ R5RS specification https://people.csail.mit.edu/jaffer/r5rs_toc.html R6RS specification https://www.r6rs.org/ R7RS specification https://small.r7rs.org/attachment/r7rs.pdf "The Scheme Programming Language" (Fourth Edition) https://scheme.com/tspl4/ == R5RS data types • number #e3 (exact) #i3 (inexact) • complex 4+1i • real 3.14 • rational 3/4 • integer 3 • booleans #t #f • pairs '(a . b) • lists '(a b) • symbols 'sym • characters #\" #\newline #\x0041 • strings "hello world" • vectors #(0 1 2) (cons 'a 'b) =====> (a . b) … dotted pair (list 'a 'b) =====> (a b) (cons 1 (cons 2 3)) … improper list (cons 1 (cons 2 (cons 3 '()))) … proper list (define x '(1 2 3 4 5)) (car x) ; 1 (cdr x) ; (2 3 4 5) (cadr x) ; 2 (list-tail x 2) ; (3 4 5) (caddr x) ; 3 (list-tail x 3) ; (4 5) (cadddr x) ; 4 (list-tail x 4) ; (5) (list-ref x 4) ; 5 == R5RS procedures list https://people.csail.mit.edu/jaffer/r5rs_14.html • ! • #b • #d • #e • #f • #i • #o • #t • #x • ' • ( • (do • (make-vector • (vector-ref • * • + • , • ,@ • - • -> • ... • / • < • <= • • = • => • > • >= • ? • ` • abs • acknowledgements • acos • and • angle • append • apply • asin • assignments • assoc • assq • assv • atan • background • backquote • begin • bibliography • binding • boolean? • booleans • bound • caar • cadr • call • call-with-current-continuation • call-with-input-file • call-with-output-file • call-with-values • call/cc • car • case • catch • cdddar • cddddr • cdr • ceiling • char->integer • char-alphabetic? • char-ci<=? • char-ci=? • char-ci>? • char-downcase • char-lower-case? • char-numeric? • char-ready? • char-upcase • char-upper-case? • char-whitespace? • char<=? • char=? • char>? • char? • characters • close-input-port • close-output-port • combination • comma • comment • complex? • cond • conditionals • cons • constant • continuation • cos • current-input-port • current-output-port • define • define-syntax • definition • definitions • delay • denominator • display • do • dynamic-wind • else • eof-object? • eq? • equal? • eqv? • error • eval • even? • exact • exact->inexact • exact? • exactness • example • exp • expressions • expt • false • floor • for-each • force • gcd • hygienic • identifier • identifiers • if • imag-part • immutable • inexact • inexact->exact • inexact? • input • input-port? • integer->char • integer? • interaction-environment • introduction • iteration • keyword • lambda • lcm • length • let • let* • let-syntax • letrec • letrec-syntax • library • list • list->string • list->vector • list-ref • list-tail • list? • load • location • log • macro • macros • magnitude • make-polar • make-rectangular • make-string • make-vector • map • max • member • memq • memv • min • modulo • mutable • negative? • newline • nil • not • notes • null-environment • null? • number • number->string • number? • numbers • numerator • object • odd? • open-input-file • open-output-file • optional • or • output • output-port? • pair • pair? • peek-char • port • port? • ports • positive? • predicate • procedure? • procedures • programs • promise • quasiquotation • quasiquotations • quasiquote • quote • quotient • rational? • rationalize • read • read-char • real-part • real? • region • remainder • reverse • round • scheme-report-environment • semantics • sequencing • set! • set-car! • set-cdr! • sin • sqrt • string • string->list • string->number • string->symbol • string-append • string-ci<=? • string-ci=? • string-ci>? • string-copy • string-fill! • string-length • string-ref • string-set! • string<=? • string=? • string>? • string? • substring • symbol->string • symbol? • syntax • syntax-rules • tan • template • token • transcript-off • transcript-on • transformers • true • truncate • type • unbound • unquote • unquote-splicing • unspecified • values • variable • vector • vector->list • vector-fill! • vector-length • vector-ref • vector-set! • vector? • whitespace • with-input-from-file • with-output-to-file • write • write-char • zero == R5RS concept list • ; • • binding construct • binding constructs • binding constructs for syntactic keywords • call by need • control features • delayed evaluation • derived expression types • disjointness of types • dotted pair • empty list • entry format • equivalence predicate • equivalence predicates • error situations and unspecified behavior • escape procedure • evaluation examples • external representations • formal semantics • formal syntax • formal syntax and semantics • implementation restriction • implementation restrictions • improper list • initial environment • input and output • internal definition • internal definitions • language changes • lazy evaluation • lexical conventions • lexical structure • library procedure • literal expressions • macro keyword • macro transformer • macro use • naming conventions • notation and terminology • numerical input and output • numerical operations • numerical types • other data types • other notations • overview of scheme • pairs and lists • pattern language • primitive expression types • primitive; library; and optional features • procedure call • procedure calls • program structure • programs and definitions • proper tail recursion • referentially transparent • simplest rational • standard procedures • storage model • strings • summary • symbols • syntactic keyword • syntax definition • syntax definitions • syntax of numerical constants • system interface • tail call • top level definitions • top level environment • valid indexes • variable references • variables; syntactic keywords; and regions • vectors • whitespace and comments == Answering my own questions "Why is the numerical set of data types called numerical tower?" Every integer is a rational, a real number, and a complex number. Every rational is a real number, and a complex number. Every real number is a complex number. A tower structure. "How to handle side effects?" Functions with side effects are usually recognizable by a final bang ("!"). However, if the main functionality is not the side effect, function names are usually not ended with a bang. Apparently, `begin` shall be used to execute a function with side effects but consecutively execute a different procedure to generate a return value == MIT/GNU Scheme supports the R7RS-small standard MIT/GNU Scheme 12.1 https://www.gnu.org/software/mit-scheme/documentation/stable/mit-scheme-ref/index.html#SEC_Contents SCIP https://sarabander.github.io/sicp/ == GNU Guile === Resources Main homepage https://www.gnu.org/software/guile/ "The Guile Reference Manual" (v3.0.9) https://www.gnu.org/software/guile/manual/guile.html Documentation per library https://www.gnu.org/software/guile/libraries/#core (lambda (x) (+ x x)) (define foo 42) (set! foo 3.14) (let ((foo 3) (bar 20)) …) (let* ((foo 42) (bar foo)) …) (letrec ((even? (lambda (n) (if (zero? n) #t (odd? (- n 1))))) (odd? (lambda (n) (if (zero? n) #f (even? (- n 1)))))) (even? 88)) (begin (display "hello") (display "world") #t) (if #t "then" "otherwise") (when #t (display "this") (display "and") (display "that")) (unless #f (display "this") (display "and") (display "that")) (cond ((> n 5) "I am great!") ((> n 3) "Sufficiently great!") (else "Your lack of greatness disturbs me!")) (case "hi" (("hi" "hello") "first matches") (("ho" "yeah") "second matches") (else "none matches")) (and #t #f) (or #t #f)