sync HtDP languages and test suite
svn: r9424
This commit is contained in:
parent
13c5e3812d
commit
e5350bb22f
|
@ -51,6 +51,9 @@
|
||||||
;; [advanced-contract contract]
|
;; [advanced-contract contract]
|
||||||
;; [advanced-define-data define-data]
|
;; [advanced-define-data define-data]
|
||||||
)
|
)
|
||||||
|
check-expect
|
||||||
|
check-within
|
||||||
|
check-error
|
||||||
#%datum
|
#%datum
|
||||||
#%top-interaction
|
#%top-interaction
|
||||||
empty true false)
|
empty true false)
|
||||||
|
@ -62,6 +65,4 @@
|
||||||
(all-from-except intermediate: lang/htdp-intermediate-lambda procedures
|
(all-from-except intermediate: lang/htdp-intermediate-lambda procedures
|
||||||
cons list* append)
|
cons list* append)
|
||||||
(all-from advanced: lang/private/advanced-funs procedures))
|
(all-from advanced: lang/private/advanced-funs procedures))
|
||||||
|
|
||||||
(provide (all-from-out test-engine/scheme-tests))
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
[intermediate-unquote unquote]
|
[intermediate-unquote unquote]
|
||||||
[intermediate-unquote-splicing unquote-splicing]
|
[intermediate-unquote-splicing unquote-splicing]
|
||||||
[beginner-module-begin #%module-begin])
|
[beginner-module-begin #%module-begin])
|
||||||
|
check-expect
|
||||||
|
check-within
|
||||||
|
check-error
|
||||||
#%datum
|
#%datum
|
||||||
#%top-interaction
|
#%top-interaction
|
||||||
empty true false)
|
empty true false)
|
||||||
|
@ -45,5 +48,4 @@
|
||||||
procedures
|
procedures
|
||||||
(all-from beginner: lang/htdp-beginner procedures))
|
(all-from beginner: lang/htdp-beginner procedures))
|
||||||
|
|
||||||
(provide (all-from-out test-engine/scheme-tests))
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
;; [beginner-contract contract]
|
;; [beginner-contract contract]
|
||||||
;; [beginner-define-data define-data]
|
;; [beginner-define-data define-data]
|
||||||
)
|
)
|
||||||
|
check-expect
|
||||||
|
check-within
|
||||||
|
check-error
|
||||||
#%datum
|
#%datum
|
||||||
#%top-interaction
|
#%top-interaction
|
||||||
empty true false)
|
empty true false)
|
||||||
|
@ -92,6 +95,4 @@
|
||||||
in-rator-position-only
|
in-rator-position-only
|
||||||
(all-from beginner: lang/private/beginner-funs procedures))
|
(all-from beginner: lang/private/beginner-funs procedures))
|
||||||
|
|
||||||
(provide (all-from-out test-engine/scheme-tests))
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,6 +39,9 @@
|
||||||
;; [intermediate-contract contract]
|
;; [intermediate-contract contract]
|
||||||
;; [intermediate-define-data define-data]
|
;; [intermediate-define-data define-data]
|
||||||
)
|
)
|
||||||
|
check-expect
|
||||||
|
check-within
|
||||||
|
check-error
|
||||||
#%datum
|
#%datum
|
||||||
#%top-interaction
|
#%top-interaction
|
||||||
empty true false)
|
empty true false)
|
||||||
|
@ -47,5 +50,4 @@
|
||||||
(provide-and-document
|
(provide-and-document
|
||||||
procedures
|
procedures
|
||||||
(all-from intermediate: lang/htdp-intermediate procedures))
|
(all-from intermediate: lang/htdp-intermediate procedures))
|
||||||
(provide (all-from-out test-engine/scheme-tests))
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
;; [intermediate-contract contract]
|
;; [intermediate-contract contract]
|
||||||
;; [intermediate-define-data define-data]
|
;; [intermediate-define-data define-data]
|
||||||
)
|
)
|
||||||
|
check-expect
|
||||||
|
check-within
|
||||||
|
check-error
|
||||||
#%datum
|
#%datum
|
||||||
#%top-interaction
|
#%top-interaction
|
||||||
empty true false)
|
empty true false)
|
||||||
|
@ -48,5 +51,4 @@
|
||||||
(provide-and-document
|
(provide-and-document
|
||||||
procedures
|
procedures
|
||||||
(all-from beginner: lang/private/intermediate-funs procedures))
|
(all-from beginner: lang/private/intermediate-funs procedures))
|
||||||
(provide (all-from-out test-engine/scheme-tests))
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -43,9 +43,9 @@ Intermediate Student language for @|htdp|; see
|
||||||
@; ------------------------------------------------------------
|
@; ------------------------------------------------------------
|
||||||
@section{@italic{HtDP} Intermediate Student with Lambda}
|
@section{@italic{HtDP} Intermediate Student with Lambda}
|
||||||
|
|
||||||
@defmodule[lang/htdp-intermediate-lam]
|
@defmodule[lang/htdp-intermediate-lambda]
|
||||||
|
|
||||||
The @schememodname[lang/htdp-intermediate-lam] module provides the
|
The @schememodname[lang/htdp-intermediate-lambda] module provides the
|
||||||
Intermediate Student with Lambda language for @|htdp|; see
|
Intermediate Student with Lambda language for @|htdp|; see
|
||||||
@htdp-ref["intermediate-lam"].
|
@htdp-ref["intermediate-lam"].
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ they can be syntactically restricted to application positions.
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@defform[(provide-higher-order-procedure id (arg ...))]{
|
@defform[(provide-higher-order-primitive id (arg ...))]{
|
||||||
|
|
||||||
Like @scheme[define-higher-order-primitive], but the function
|
Like @scheme[define-higher-order-primitive], but the function
|
||||||
@scheme[id] is exported as the primitive operator named
|
@scheme[id] is exported as the primitive operator named
|
||||||
|
|
|
@ -604,16 +604,21 @@
|
||||||
(define (intermediate-pre-lambda/proc stx)
|
(define (intermediate-pre-lambda/proc stx)
|
||||||
(beginner-lambda/proc stx))
|
(beginner-lambda/proc stx))
|
||||||
|
|
||||||
(define (check-defined-lambda lam)
|
(define (check-defined-lambda rhs)
|
||||||
(syntax-case lam (intermediate-pre-lambda)
|
(syntax-case rhs ()
|
||||||
[(intermediate-pre-lambda arg-seq lexpr ...)
|
[(lam . _)
|
||||||
|
(and (identifier? #'lam)
|
||||||
|
(or (module-identifier=? #'lam #'beginner-lambda)
|
||||||
|
(module-identifier=? #'lam #'intermediate-pre-lambda)))
|
||||||
|
(syntax-case rhs ()
|
||||||
|
[(lam arg-seq lexpr ...)
|
||||||
(syntax-case (syntax arg-seq) () [(arg ...) #t][_else #f])
|
(syntax-case (syntax arg-seq) () [(arg ...) #t][_else #f])
|
||||||
(let ([args (syntax->list (syntax arg-seq))])
|
(let ([args (syntax->list (syntax arg-seq))])
|
||||||
(for-each (lambda (arg)
|
(for-each (lambda (arg)
|
||||||
(unless (identifier/non-kw? arg)
|
(unless (identifier/non-kw? arg)
|
||||||
(teach-syntax-error
|
(teach-syntax-error
|
||||||
'lambda
|
'lambda
|
||||||
lam
|
rhs
|
||||||
arg
|
arg
|
||||||
"expected a name for a function argument, but found ~a"
|
"expected a name for a function argument, but found ~a"
|
||||||
(something-else/kw arg))))
|
(something-else/kw arg))))
|
||||||
|
@ -621,37 +626,38 @@
|
||||||
(when (null? args)
|
(when (null? args)
|
||||||
(teach-syntax-error
|
(teach-syntax-error
|
||||||
'lambda
|
'lambda
|
||||||
lam
|
rhs
|
||||||
(syntax arg-seq)
|
(syntax arg-seq)
|
||||||
"expected at least one argument name in the sequence after `lambda', but found none"))
|
"expected at least one argument name in the sequence after `lambda', but found none"))
|
||||||
(let ([dup (check-duplicate-identifier args)])
|
(let ([dup (check-duplicate-identifier args)])
|
||||||
(when dup
|
(when dup
|
||||||
(teach-syntax-error
|
(teach-syntax-error
|
||||||
'lambda
|
'lambda
|
||||||
lam
|
rhs
|
||||||
dup
|
dup
|
||||||
"found an argument name that was used more than once: ~a"
|
"found an argument name that was used more than once: ~a"
|
||||||
(syntax-e dup))))
|
(syntax-e dup))))
|
||||||
(check-single-result-expr (syntax->list (syntax (lexpr ...)))
|
(check-single-result-expr (syntax->list (syntax (lexpr ...)))
|
||||||
#f
|
#f
|
||||||
lam
|
rhs
|
||||||
args)
|
args)
|
||||||
'ok)]
|
'ok)]
|
||||||
;; Bad lambda because bad args:
|
;; Bad lambda because bad args:
|
||||||
[(intermediate-pre-lambda args . _)
|
[(lam args . _)
|
||||||
(teach-syntax-error
|
(teach-syntax-error
|
||||||
'lambda
|
'lambda
|
||||||
lam
|
rhs
|
||||||
(syntax args)
|
(syntax args)
|
||||||
"expected a sequence of function arguments after `lambda', but found ~a"
|
"expected a sequence of function arguments after `lambda', but found ~a"
|
||||||
(something-else (syntax args)))]
|
(something-else (syntax args)))]
|
||||||
;; Bad lambda, no args:
|
;; Bad lambda, no args:
|
||||||
[(intermediate-pre-lambda)
|
[(lam)
|
||||||
(teach-syntax-error
|
(teach-syntax-error
|
||||||
'lambda
|
'lambda
|
||||||
lam
|
rhs
|
||||||
(syntax args)
|
(syntax args)
|
||||||
"expected a sequence of function arguments after `lambda', but nothing's there")]
|
"expected a sequence of function arguments after `lambda', but nothing's there")]
|
||||||
|
[_else 'ok])]
|
||||||
[_else 'ok]))
|
[_else 'ok]))
|
||||||
|
|
||||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"debugger-language-interface.ss"
|
"debugger-language-interface.ss"
|
||||||
stepper/private/shared
|
stepper/private/shared
|
||||||
scheme/class
|
scheme/class
|
||||||
scheme/contract)
|
scheme/contract
|
||||||
|
test-engine/scheme-tests)
|
||||||
|
|
||||||
(provide/contract
|
(provide/contract
|
||||||
[expand-teaching-program (->* (input-port?
|
[expand-teaching-program (->* (input-port?
|
||||||
|
@ -58,7 +59,7 @@
|
||||||
,@(map (λ (x) `(require ,x)) teachpacks)
|
,@(map (λ (x) `(require ,x)) teachpacks)
|
||||||
,@body-exps
|
,@body-exps
|
||||||
,@(if enable-testing?
|
,@(if enable-testing?
|
||||||
(if (null? body-exps) '() '((run-tests) (display-results)))
|
(if (null? body-exps) '() `((,#'run-tests) (,#'display-results)))
|
||||||
'()))))
|
'()))))
|
||||||
rep)))]
|
rep)))]
|
||||||
[(require)
|
[(require)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
(make-sec 'net-library
|
(make-sec 'net-library
|
||||||
"Network Libraries")
|
"Network Libraries")
|
||||||
(make-sec 'parsing-library
|
(make-sec 'parsing-library
|
||||||
"GUI and Graphics Libraries")
|
"Parsing Libraries")
|
||||||
(make-sec 'tool-library
|
(make-sec 'tool-library
|
||||||
"Tool Libraries")
|
"Tool Libraries")
|
||||||
(make-sec 'foreign
|
(make-sec 'foreign
|
||||||
|
|
|
@ -218,7 +218,7 @@
|
||||||
(htdp-teachpack-pop)
|
(htdp-teachpack-pop)
|
||||||
|
|
||||||
;; Check require
|
;; Check require
|
||||||
(htdp-top (require mzlib/unit))
|
(htdp-top (require (lib "unit.ss" "mzlib")))
|
||||||
(htdp-test #f unit? 12)
|
(htdp-test #f unit? 12)
|
||||||
(htdp-top-pop 1)
|
(htdp-top-pop 1)
|
||||||
|
|
||||||
|
|
|
@ -134,9 +134,13 @@
|
||||||
(define test (namespace-variable-value 'test))
|
(define test (namespace-variable-value 'test))
|
||||||
(provide test))
|
(provide test))
|
||||||
|
|
||||||
|
(define (print-eval stx)
|
||||||
|
(printf "~s\n" (syntax->datum stx))
|
||||||
|
(eval stx))
|
||||||
|
|
||||||
(define (do-htdp-test stx stx-err? exn?)
|
(define (do-htdp-test stx stx-err? exn?)
|
||||||
(let ([name (gensym 'm)])
|
(let ([name (gensym 'm)])
|
||||||
((if stx-err? syntax-test eval)
|
((if stx-err? syntax-test print-eval)
|
||||||
#`(module #,name 'helper
|
#`(module #,name 'helper
|
||||||
test
|
test
|
||||||
#,current-htdp-lang #%module-begin
|
#,current-htdp-lang #%module-begin
|
||||||
|
|
|
@ -145,6 +145,11 @@ but we start with an enumeration of changes:
|
||||||
- UTF-8 decoding for ports uses #\uFFFD instead of #\? as the
|
- UTF-8 decoding for ports uses #\uFFFD instead of #\? as the
|
||||||
replacement character for bad encodings.
|
replacement character for bad encodings.
|
||||||
|
|
||||||
|
- Inside PLT Scheme: the `mzscheme' module is no longer built into
|
||||||
|
the exectable. When embedding PLT Scheme in a larger application,
|
||||||
|
use `mzc --c-mods' to convert a set of modules into embeddable C
|
||||||
|
code (as a static byte array containing bytecode).
|
||||||
|
|
||||||
======================================================================
|
======================================================================
|
||||||
Porting Advice
|
Porting Advice
|
||||||
======================================================================
|
======================================================================
|
||||||
|
|
Loading…
Reference in New Issue
Block a user