2 Schreibe Dein Programm!

► |  | Sprachebenen und Material zu Schreibe Dein Programm!

1 | Schreibe Dein Programm! - Anfänger
2 | Schreibe Dein Programm!
3 | Schreibe Dein Programm! - fortgeschritten
4 | Konstruktionsanleitungen
5 | sdp: Sprachen als Libraries
| Index

▼ | 2 | Schreibe Dein Programm!

2.1 | Signaturen
2.2 | let, letrec und let*
2.3 | Pattern-Matching
2.4 | Primitive Operationen

top contents ← prev up next →

## 2 Schreibe Dein Programm!🔗ℹ

This is documentation for the language level Schreibe Dein Programm! to go with the German textbooks Schreibe Dein Programm!.

program |  | = |  | def-or-expr ...
def-or-expr |  | = |  | definition
|  | | |  | expr
|  | | |  | test-case
definition |  | = |  | (define id expr)
|  | | |  | (define-record id id (id id) ...)
|  | | |  | (define-record id id id (id id) ...)
|  | | |  | (define-record (id id ...) id id (id id) ...)
|  | | |  | (define-singleton id id id)
|  | | |  | (: id sig)
expr |  | = |  | (expr expr ...) ; Funktionsapplikation
|  | | |  | #t
|  | | |  | #f
|  | | |  | number
|  | | |  | string
|  | | |  | (lambda (id ...) definition ... expr)
|  | | |  | (λ (id ...) definition ... expr)
|  | | |  | id ; Name
|  | | |  | (cond (expr definition ... expr) (expr definition ... expr) ...)
|  | | |  | (cond (expr definition ... expr) ... (else definition ... expr))
|  | | |  | (if expr expr)
|  | | |  | (and expr ...)
|  | | |  | (or expr ...)
|  | | |  | (match expr (pattern definition ... expr) ...)
|  | | |  | (signature sig)
|  | | |  | (for-all ((id sig) ...) definition ... expr)
|  | | |  | (==> expr expr)
|  | | |  | (let ((id expr) (... ...)) expr)
|  | | |  | (letrec ((id expr) (... ...)) expr)
|  | | |  | (let* ((id expr) (... ...)) expr)
sig |  | = |  | id
|  | | |  | (predicate expr)
|  | | |  | (enum expr ...)
|  | | |  | (mixed sig ...)
|  | | |  | (sig ... -> sig) ; Funktions-Signatur
|  | | |  | %a %b %c ; Signatur-Variable
|  | | |  | (combined sig ...)
|  | | |  | (list-of sig)
|  | | |  | (cons-list-of sig)
pattern |  | = |  | #t
|  | | |  | #f
|  | | |  | number
|  | | |  | string
|  | | |  | id
|  | | |  | ...
|  | | |  | (constructor pattern ...)
|  | | |  | empty
|  | | |  | (cons pattern pattern)
|  | | |  | (list pattern ...)
test-case |  | = |  | (check-expect expr expr)
|  | | |  | (check-within expr expr expr)
|  | | |  | (check-member-of expr expr ...)
|  | | |  | (check-satisfied expr expr)
|  | | |  | (check-range expr expr expr)
|  | | |  | (check-error expr expr)
|  | | |  | (check-property expr)

Ein id ist eine Folge von Zeichen, die weder Leerzeichen noch eins der folgenden Zeichen enthält:
" , ' ` ( ) [ ] { } | ; #
Ein number ist eine Zahl wie z.B. 123, 3/2 oder 5.5.
Ein string ist eine Zeichenkette, und durch ein Paar von " umschlossen. So sind z.B. "abcdef", "This is a string" und "Dies ist eine Zeichenkette, die \" enthält." Zeichenketten.

Zahlen
* : (number number number ... -> number)
+ : (number number number ... -> number)
- : (number number ... -> number)
/ : (number number number ... -> number)
< : (real real real ... -> boolean)
<= : (real real real ... -> boolean)
= : (number number number ... -> boolean)
> : (real real real ... -> boolean)
>= : (real real real ... -> boolean)
abs : (real -> real)
acos : (number -> number)
angle : (number -> real)
asin : (number -> number)
atan : (number -> number)
ceiling : (real -> integer)
complex? : (any -> boolean)
cos : (number -> number)
current-seconds : (-> natural)
denominator : (rational -> natural)
even? : (integer -> boolean)
exact->inexact : (number -> number)
exact? : (number -> boolean)
exp : (number -> number)
expt : (number number -> number)
floor : (real -> integer)
gcd : (integer integer ... -> natural)
imag-part : (number -> real)
inexact->exact : (number -> number)
inexact? : (number -> boolean)
integer? : (any -> boolean)
lcm : (integer integer ... -> natural)
log : (number -> number)
magnitude : (number -> real)
make-polar : (real real -> number)
max : (real real ... -> real)
min : (real real ... -> real)
modulo : (integer integer -> integer)
natural? : (any -> boolean)
negative? : (number -> boolean)
number->string : (number -> string)
number? : (any -> boolean)
numerator : (rational -> integer)
odd? : (integer -> boolean)
positive? : (number -> boolean)
quotient : (integer integer -> integer)
random : (natural -> natural)
rational? : (any -> boolean)
real-part : (number -> real)
real? : (any -> boolean)
remainder : (integer integer -> integer)
round : (real -> integer)
sin : (number -> number)
sqrt : (number -> number)
string->number : (string -> (mixed number false))
tan : (number -> number)
zero? : (number -> boolean)
boolesche Werte
boolean=? : (boolean boolean -> boolean)
boolean? : (any -> boolean)
equal? : (any any -> boolean)
false? : (any -> boolean)
not : (boolean -> boolean)
true? : (any -> boolean)
Listen
append : ((list-of %a) ... -> (list-of %a))
cons : (%a (list-of %a) -> (list-of %a))
cons? : (any -> boolean)
empty : list
empty? : (any -> boolean)
filter : ((%a -> boolean) (list-of %a) -> (list-of %a))
first : ((list-of %a) -> %a)
fold : (%b (%a %b -> %b) (list-of %a) -> %b)
length : ((list-of %a) -> natural)
list : (%a ... -> (list-of %a))
list-ref : ((list-of %a) natural -> %a)
rest : ((list-of %a) -> (list-of %a))
reverse : ((list-of %a) -> (list-of %a))
Zeichenketten
string->strings-list : (string -> (list-of string))
string-append : (string string ... -> string)
string-length : (string -> natural)
string<=? : (string string string ... -> boolean)
string<? : (string string string ... -> boolean)
string=? : (string string string ... -> boolean)
string>=? : (string string string ... -> boolean)
string>? : (string string string ... -> boolean)
string? : (any -> boolean)
strings-list->string : ((list-of string) -> string)
Symbole
Verschiedenes
for-each : ((%a -> %b) (list-of %a) -> unspecific)
map : ((%a -> %b) (list-of %a) -> (list-of %b))
read : (-> any)
signature? : (any -> boolean)
violation : (string -> unspecific)
write-newline : (-> unspecific)
write-string : (string -> unspecific)

top contents ← prev up next →