Table of Contents for Programming Languages: a survey
Scheme and Racket
Because the Lisp family is so well-liked, Racket gets its own chapter (as a representative of Scheme/Lisp).
Descended from Scheme.
Good at:
Popularity:
- Beloved by those who use it, but not popular
Tutorials, books, etc:
Retrospectives
Respected exemplar code
Racket opinions
(Often opinionated) Comparisons
Scheme fundamental and library forms
From http://en.m.wikipedia.org/wiki/Scheme_%28programming_language%29#Minimalism :
Fundamental forms:
- define
- lambda
- if
- quote
- unquote
- unquote-splicing
- quasiquote
- define-syntax
- let-syntax
- letrec-syntax
- syntax-rules
- set!
Library forms:
- do
- let
- let*
- letrec
- cond
- case
- and
- or
- begin
- named let
- delay
Standard forms in R5RS Scheme
from http://en.m.wikipedia.org/wiki/Scheme_%28programming_language%29#Standard_forms
- Definition: define
- Binding constructs: lambda, do (L), let (L), let* (L), letrec (L)
- Conditional evaluation: if, cond (L), case (L), and (L), or (L)
- Sequential evaluation: begin (*)
- Iteration: lambda, do (L), named let (L)
- Syntactic extension: define-syntax, let-syntax, letrec-syntax, syntax-rules (R5RS), syntax-case (R6RS)
- Quoting: quote('), unquote(,), , quasiquote(`), , unquote-splicing(,@)
- Assignment: set!
- Delayed evaluation: delay (L)
Standard procedures in the language R5RS Scheme
from http://en.m.wikipedia.org/wiki/Scheme_%28programming_language%29#Standard_procedures :
- Construction: vector, make-vector, make-string, list
- Equivalence predicates: eq?, eqv?, equal?, string=?, string-ci=?, char=?, char-ci=?
- Type conversion: vector->list, list->vector, number->string, string->number, symbol->string, string->symbol, char->integer, integer->char, string->list, list->string
- Numbers: See separate table
- Strings: string?, make-string, string, string-length, string-ref, string-set!, string=?, string-ci=?, string<? string-ci<?, string<=? string-ci<=?, string>? string-ci>?, string>=? string-ci>=?, substring, string-append, string->list, list->string, string-copy, string-fill!
- Characters: char?, char=?, char-ci=?, char<? char-ci<?, char<=? char-ci<=?, char>? char-ci>?, char>=? char-ci>=?, char-alphabetic?, char-numeric?, char-whitespace?, char-upper-case?, char-lower-case?, char->integer, integer->char, char-upcase, char-downcase
- Vectors: make-vector, vector, vector?, vector-length, vector-ref, vector-set!, vector->list, list->vector, vector-fill!
- Symbols: symbol->string, string->symbol, symbol?
- Pairs and lists: pair?, cons, car, cdr, set-car!, set-cdr!, null?, list?, list, length, append, reverse, list-tail, list-ref, memq. memv. member, assq, assv, assoc, list->vector, vector->list, list->string, string->list
- Identity predicates: boolean?, pair?, symbol?, number?, char?, string?, vector?, port?, procedure?
- Continuations: call-with-current-continuation (call/cc), values, call-with-values, dynamic-wind
- Environments: eval, scheme-report-environment, null-environment, interaction-environment (optional)
- Input/output: display, newline, read, write, read-char, write-char, peek-char, char-ready?, eof-object? open-input-file, open-output-file, close-input-port, close-output-port, input-port?, output-port?, current-input-port, current-output-port, call-with-input-file, call-with-output-file, with-input-from-file(optional), with-output-to-file(optional)
- System interface: load (optional), transcript-on (optional), transcript-off (optional)
- Functional programming: procedure?, apply, map, for-each
- Booleans: boolean? not
numeric procedures
- Basic arithmetic operators: +, -, *, /, abs, quotient, remainder, modulo, gcd, lcm, expt, sqrt
- Rational numbers: numerator, denominator, rational?, rationalize
- Approximation: floor, ceiling, truncate, round
- Exactness: inexact->exact, exact->inexact, exact?, inexact?
- Inequalities: <, <=, >, >=, =
- Miscellaneous predicates: zero?, negative?, positive? odd? even?
- Maximum and minimum: max, min
- Trigonometry and exponentials and complex numbers: sin, cos, tan, asin, acos, atan, exp, log, make-rectangular, make-polar, real-part, imag-part, magnitude, angle, complex?
- Input-output: number->string, string->number
- Type predicates: integer?, rational?, real?, complex?, number?
Scheme base library
Quoted and paraphrased from http://www.gnu.org/software/guile/manual/html_node/rnrs-base.html . This list is based off of that link (part of GNU Guile's documentation), but i can't tell if if it meant to be R6RS or R5RS or some mix or something else. For our purposes, it doesn't really matter.
Atomic(ish) data: Strings, characters, symbols, numbers
Symbol and character manipulation
- symbol->string, string->symbol
- char=?, char<?, char>?, char<=?, char>=?
- integer->char, char->integer
Strings
- number->string, string->number, string char, make-string, list->string, string->list
- string-length str
- string-ref
- string-copy, substring
- string=?, string<?, string>?, string<=?, string>=?
- string-append
- string-for-each proc s [start [end]]
Numbers, arithmetic, and math
- real-part, imag-part, make-rectangular, make-polar, magnitude, angle
- sqrt, exp, expt, log, sin, cos, tan, asin, acos, atan
- numerator, denominator, rationalize
- exact, inexact?, exact, inexact, exact-integer-sqrt
- odd?, even?
- gcd, lcm
- +, -, *, /
- div, mod, div-and-mod, div0, mod0, div0-and-mod0
- max, min
- abs, truncate, floor, ceiling, round
- real-valued?, rational-valued?, integer-valued?
- nan?, infinite?, finite?
Composite data: Lists, vectors, pairs
Lists and vectors
- list elem ..., vector arg ...: list and vector constructors
- length, vector-length
- list-ref lst k, vector-ref vector k: access list element
- list->vector, vector->list
Lists
- null?
- list-tail lst k
- append lst ... obj
- append
- reverse lst
Vectors
- vector-set! vector k obj
- vector-fill! v fill
- vector-map proc v: map over a vector
- vector-for-each proc v: for-each over a vector
- make-vector len, make-vector len fill
Pairs
- cons
- car, cdr, caar, cadr, ..., cddddr
Variables
- define name value: see Definition
- set! variable-name value: see Definition
- let, let*, letrec, letrec*, let-values, let*-values: All take two arguments: bindings, body. See Local Bindings, SRFI-11
- begin expr1 expr2 ...: 'begin' can be used for the separate function of splicing (evaluating a list of expressions as if they were each lexically scoped where the 'begin' is). See begin
Conditionals, boolean ops, equality, comparison
- if test consequence [alternate]
- cond clause1 clause2 ...: see Conditionals
- case key clause1 clause2 ...
- not, and, or
- eq? (alias symbol=), eqv?, equal?: See Equality
- =, <, >, <=, >=, zero?, positive?, negative?: See Comparison.
Control flow, functions, continuations
- begin expr1 expr2 ...: Evaluate a sequence of expressions in order (sequencing). Used for imperative programming. Also, used for the separate function of splicing (see section 'Variables', above). See also begin
- lambda formals body
- apply proc arg ... arglst
- call-with-current-continuation (alias: call/cc): See Continuations
- values arg ...: return multiple values
- call-with-values producer consumer: call producer, then feed the multiple values returned by producer into consumer
- dynamic-wind in_guard thunk out_guard: See dynamic-wind
- for-each f lst1 lst2 ...: map(zipn)
Exception handling
- assert expr
- error who message irritant1 ...
- assertion-violation who message irritant1 ...
Type predicates
- boolean?, symbol?, list?, pair?, number?, string?, procedure?, complex?, char?, vector?, integer?, real?, rational?
Metaprogramming: Macros and syntax rules and quoting
Widely-supported Scheme SRFIs
According to http://en.m.wikipedia.org/wiki/Scheme_%28programming_language%29#Scheme_Requests_for_Implementation (see also http://srfi.schemers.org/final-srfis.html , http://en.m.wikipedia.org/wiki/Scheme_(programming_language)#cite_note-srfi_support-28 ):
- 0: feature-based conditional expansion construct
- 1: list library
- 4: homogeneous numeric vector datatypes
- 6: basic string ports
- 8: receive, binding to multiple values
- 9: defining record types
- 13: string library
- 14: character-set library
- 16: syntax for procedures of variable arity
- 17: generalized set!
- 18: Multithreading support
- 19: time data types and procedures
- 25: multi-dimensional array primitives
- 26: notation for specializing parameters without currying
- 27: sources of random bits
- 28: basic format strings
- 29: localization
- 30: nested multi-line comments
- 31: a special form for recursive evaluation
- 37: args-fold: a program argument processor
- 39: parameter objects
- 41: streams
- 42: eager comprehensions
- 43: vector library
- 45: primitives for expressing iterative lazy algorithms
- 60: integers as bits
- 61: a more general cond clause
- 66: octet vectors
- 67: compare procedures
Typed racket
https://docs.racket-lang.org/ts-guide/index.html
https://docs.racket-lang.org/ts-reference/index.html
Internals
Garbage collection
Variants and extensions