Sketchy LISP |
Copyright (C) 2006,2007
Nils M Holm Buy a copy at Lulu.com |
An Introduction to Functional Programming in Scheme
| Previous Section | - Contents - Index - | -/- |
This is a summary of the Scheme syntax and procedures discussed in this book.
body a sequence of expressions
char a char
expr any type
form any datum
int an integer
list a list
num any numeric type
pair a pair
proc a procedure
procn a procedure of n arguments
str a string
sym a symbol
tval a truth value
void an unspecific value
[x] x is optional
x ... zero or more occurrences of x
x|y x or y
'form => formquote.,expr => formquasiquote template.
Alias: unquote.,@expr => spliced-formquasiquote template and
splice into surrounding list. Alias: unquote-splicing.`qq-template => formquasiquote.(and expr1 ...) => form#f.(begin expr1 ...) => form(case expr (list1 body1) (list2 body2) ...) => form(cond (expr1 body1) (expr2 body2) ...) => form(define sym expr) => void(define (sym1 sym2 ...) body) => void(define (sym1 sym2 ... . symn) body) => void(define-syntax keyword transformer) => voidsyntax-rules.(if expr1 expr2 [expr3]) => form(lambda sym body) => proc(lambda (sym1 sym2 ... . symn) body) => proc(lambda (sym1 ...) body) => proc(let ((sym1 expr1) ...) body) => form(let* ((sym1 expr1) ...) body) => formlet, but bind expressions to symbols sequentially.(letrec ((sym1 expr1) ...) body) => formlet, but fix recursive references.(or expr1 ...) => form(quasiquote qq-template) => form`.(quote form) => form'.(set! sym expr) => void(syntax-rules (sym1 ...) (pat1 temp1) (pat2 temp2) ...) => transformerdefine-syntax.(unquote expr) => formquasiquote template.
Alias: ,.(unquote-splicing expr) => spliced-formquasiquote template and
splice into surrounding list. Alias: ,@.(* num1 ...) => num(+ num1 ...) => num(- num1 num2 ...) => num(/ num1 num2 ...) => num(< num1 num2 num3 ...) => tval(<= num1 num2 num3 ...) => tval(> num1 num2 num3 ...) => tval(>= num1 num2 num3 ...) => tval< checks whether its arguments are in strict ascending
order.(= num1 num2 num3 ...) => tval(abs num) => num(append list1 ...) => list(append list1 ... expr) => pair(apply proc expr1 ... list) => form(assoc expr alist) => pair|#fequal? to compare keys.(assq expr alist) => pair|#feq? to compare keys.(assv expr alist) => pair|#feqv? to compare keys.(caar pair) ... (cddddr pair) => form(cadr x) =
(car (cdr x)).(call-with-current-continuation proc1) => form(call/cc proc1) => form(car pair) => form(cdr pair) => form(char-ci<? char1 char2 char3 ...) => tval(char-ci<=? char1 char2 char3 ...) => tval(char-ci>? char1 char2 char3 ...) => tval(char-ci>=? char1 char2 char3 ...) => tvalchar-ci<? checks whether its arguments are in strict
alphabetical order. Ignore the case of the characters.(char-ci=? char1 char2 char3 ...) => tval(char->integer char) => int(char-alphabetic? char) => tval(char-lower-case? char) => tval(char-numeric? char) => tval(char-upper-case? char) => tval(char-whitespace? char) => tval(char-numeric? x) checks whether x is
in the range #\0...#\9.(char-downcase char) => char(char-upcase char) => char(char-upcase #\c) => #\C.(char<? char1 char2 char3 ...) => tval(char<=? char1 char2 char3 ...) => tval(char>? char1 char2 char3 ...) => tval(char>=? char1 char2 char3 ...) => tvalchar<? checks whether its arguments are in strict
alphabetical order.(char=? char1 char2 char3 ...) => tval(cons expr1 expr2) => pair(display expr [out-port]) => voidwrite. If an output port is specified, write to that port.
(eof-object? expr) => tval(eq? expr1 expr2) => tval(equal? expr1 expr2) => tval(eqv? expr1 expr2) => tval(floor num) => int(gcd int1 ...) => int(integer->char int) => char(lcm int1 ...) => int(length list) => int(list expr1 ...) => list(list->string list) => str(list-ref list int) => form(list? expr) => tval(map proc list1 list2 ...) => list(max num1 num2 ...) => num(member expr list) => list|#f#f if no such sublist exists.
Use equal? to compare list elements.(memq expr list) => list|#f#f if no such sublist exists.
Use eq? to compare list elements.(memv expr list) => list|#f#f if no such sublist exists.
Use eqv? to compare list elements.(min num1 num2 ...) => num(modulo int1 int2) => int(negative? num) => tval(newline [out-port]) => void(not expr) => tval(eq? expr #f).(null? expr) => tval(number? expr) => tval(pair? expr) => tval(quotient int1 int2) => int(read [in-port]) => form(read-char [in-port]) => char(remainder int1 int2) => int(sqrt num) => num(string char1 ...) => str(string->list str) => list(string->symbol str) => sym(string-ci<=? str1 str2 str3 ...) => tval(string-ci<? str1 str2 str3 ...) => tval(string-ci>=? str1 str2 str3 ...) => tval(string-ci>? str1 str2 str3 ...) => tvalstring-ci<? checks whether its arguments are in
strict alphabetical order. Ignore case.(string-ci=? str1 str2 str3 ...) => tval(string-length str) => int(string-ref str int) => char(string<=? str1 str2 str3 ...) => tval(string<? str1 str2 str3 ...) => tval(string>=? str1 str2 str3 ...) => tval(string>? str1 str2 str3 ...) => tvalstring<? checks whether its arguments are in strict
alphabetical order.(string=? str1 str2 str3 ...) => tval(substring str int1 int2) => str(symbol->string sym) => str(with-input-from-file str proc0) => form(with-output-to-file str proc0) => form(write expr [out-port]) => void(zero? num) => tval| Previous Section | - Contents - Index - | -/- |