Add `list-of' signature to DMdA languages.
This commit is contained in:
parent
350cef9af8
commit
050f0a141b
|
@ -11,7 +11,7 @@
|
||||||
.. ... .... ..... ......
|
.. ... .... ..... ......
|
||||||
check-expect check-within check-error check-member-of check-range
|
check-expect check-within check-error check-member-of check-range
|
||||||
check-property for-all ==> expect expect-within expect-member-of expect-range
|
check-property for-all ==> expect expect-within expect-member-of expect-range
|
||||||
signature contract : define-contract -> mixed one-of predicate combined
|
signature contract : define-contract -> mixed one-of predicate combined list-of
|
||||||
number real rational integer natural boolean true false string symbol empty-list unspecific property
|
number real rational integer natural boolean true false string symbol empty-list unspecific property
|
||||||
chocolate-cookie)
|
chocolate-cookie)
|
||||||
(provide cons)
|
(provide cons)
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
.. ... .... ..... ......
|
.. ... .... ..... ......
|
||||||
check-expect check-within check-error check-member-of check-range
|
check-expect check-within check-error check-member-of check-range
|
||||||
check-property for-all ==> expect expect-within expect-member-of expect-range
|
check-property for-all ==> expect expect-within expect-member-of expect-range
|
||||||
signature contract : define-contract -> mixed one-of predicate combined
|
signature contract : define-contract -> mixed one-of predicate combined list-of
|
||||||
number real rational integer natural boolean true false string empty-list unspecific property
|
number real rational integer natural boolean true false string empty-list unspecific property
|
||||||
chocolate-cookie)
|
chocolate-cookie)
|
||||||
(provide cons)
|
(provide cons)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
.. ... .... ..... ......
|
.. ... .... ..... ......
|
||||||
check-expect check-within check-error check-member-of check-range
|
check-expect check-within check-error check-member-of check-range
|
||||||
check-property for-all ==> expect expect-within expect-member-of expect-range
|
check-property for-all ==> expect expect-within expect-member-of expect-range
|
||||||
signature contract : define-contract -> mixed one-of predicate combined
|
signature contract : define-contract -> mixed one-of predicate combined list-of
|
||||||
number real rational integer natural boolean true false string empty-list property
|
number real rational integer natural boolean true false string empty-list property
|
||||||
chocolate-cookie)
|
chocolate-cookie)
|
||||||
(provide cons)
|
(provide cons)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
(provide (all-from-out test-engine/scheme-tests))
|
(provide (all-from-out test-engine/scheme-tests))
|
||||||
(provide signature define-contract :
|
(provide signature define-contract :
|
||||||
contract ; legacy
|
contract ; legacy
|
||||||
-> mixed one-of predicate combined)
|
-> mixed one-of predicate combined list-of)
|
||||||
|
|
||||||
(provide number real rational integer natural
|
(provide number real rational integer natural
|
||||||
boolean true false
|
boolean true false
|
||||||
|
|
|
@ -283,12 +283,6 @@ für den Rückgabewert.
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
@subsection{@scheme[list]}
|
|
||||||
@defform[(list sig)]{
|
|
||||||
Diese Signatur ist dann für einen Wert gültig, wenn dieser eine Liste ist,
|
|
||||||
für dessen Elemente @scheme[sig] gültig ist.
|
|
||||||
}
|
|
||||||
|
|
||||||
@subsection[#:tag "signature-variable"]{Signatur-Variablen}
|
@subsection[#:tag "signature-variable"]{Signatur-Variablen}
|
||||||
@defform/none[%a]
|
@defform/none[%a]
|
||||||
@defform/none[%b]
|
@defform/none[%b]
|
||||||
|
|
|
@ -24,3 +24,12 @@ Abstraktion}.
|
||||||
@section[#:tag "vanilla-prim-op"]{Primitive Operationen}
|
@section[#:tag "vanilla-prim-op"]{Primitive Operationen}
|
||||||
|
|
||||||
@prim-op-defns['(lib "DMdA-vanilla.ss" "deinprogramm") #'here '()]
|
@prim-op-defns['(lib "DMdA-vanilla.ss" "deinprogramm") #'here '()]
|
||||||
|
|
||||||
|
@section[#:tag "signatures-vanilla"]{Signaturen}
|
||||||
|
|
||||||
|
@subsection{@scheme[list-of]}
|
||||||
|
@defform[(list-of sig)]{
|
||||||
|
Diese Signatur ist dann für einen Wert gültig, wenn dieser eine Liste ist,
|
||||||
|
für dessen Elemente @scheme[sig] gültig ist.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
signature signature/arbitrary
|
signature signature/arbitrary
|
||||||
define-contract contract ; legacy
|
define-contract contract ; legacy
|
||||||
define/signature define-values/signature
|
define/signature define-values/signature
|
||||||
-> mixed one-of predicate combined property)
|
-> mixed one-of predicate combined property list-of)
|
||||||
|
|
||||||
(require deinprogramm/signature/signature
|
(require deinprogramm/signature/signature
|
||||||
scheme/promise
|
scheme/promise
|
||||||
|
@ -59,6 +59,11 @@
|
||||||
(?name name)
|
(?name name)
|
||||||
(?signature-expr (parse-signature #f #'?signature)))
|
(?signature-expr (parse-signature #f #'?signature)))
|
||||||
#'(make-list-signature '?name ?signature-expr ?stx)))
|
#'(make-list-signature '?name ?signature-expr ?stx)))
|
||||||
|
((list-of ?signature)
|
||||||
|
(with-syntax ((?stx (phase-lift stx))
|
||||||
|
(?name name)
|
||||||
|
(?signature-expr (parse-signature #f #'?signature)))
|
||||||
|
#'(make-list-signature '?name ?signature-expr ?stx)))
|
||||||
((list ?signature1 ?rest ...)
|
((list ?signature1 ?rest ...)
|
||||||
(raise-syntax-error #f
|
(raise-syntax-error #f
|
||||||
"list-Vertrag darf nur einen Operanden haben."
|
"list-Vertrag darf nur einen Operanden haben."
|
||||||
|
@ -269,5 +274,4 @@
|
||||||
(define-syntax predicate within-signature-syntax-transformer)
|
(define-syntax predicate within-signature-syntax-transformer)
|
||||||
(define-syntax combined within-signature-syntax-transformer)
|
(define-syntax combined within-signature-syntax-transformer)
|
||||||
(define-syntax property within-signature-syntax-transformer)
|
(define-syntax property within-signature-syntax-transformer)
|
||||||
; not a good idea:
|
(define-syntax list-of within-signature-syntax-transformer)
|
||||||
; (define-syntax list within-signature-syntax-transformer)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user