;; Die ersten drei Zeilen dieser Datei wurden von DrRacket eingefügt. Sie enthalten Metadaten ;; über die Sprachebene dieser Datei in einer Form, die DrRacket verarbeiten kann. #reader(lib "DMdA-beginner-reader.ss" "deinprogramm")((modname parametriclist) (read-case-sensitive #f) (teachpacks ()) (deinprogramm-settings #(#f write repeating-decimal #f #t none explicit #f ()))) (define-record-procedures-parametric nonempty-list nonempty-list-of cons cons? (first rest)) ; Signaturkonstruktor für Listen: (define list-of (lambda (sig) (signature (mixed empty-list (nonempty-list-of sig (list-of sig)))))) (: cons (%a (list-of %a) -> (nonempty-list-of %a (list-of %a)))) (: cons? (any -> boolean)) (: first ((nonempty-list-of %a (list-of %a)) -> %a)) (: rest ((nonempty-list-of %a (list-of %a)) -> (list-of %a))) (: list12 (list-of number)) (define list12 (cons 1 (cons 2 empty))) (: hw (list-of string)) (define hw (cons "Hello" (cons "World" empty))) ; Führt zu einer Signaturverletzung ;(: alist (list-of number)) ;(define alist (cons 2 (cons "Scheme" (cons #t empty))))