utils: Explicitly document the untyped submodule.
This commit is contained in:
parent
650801a6d2
commit
b1613ac1f7
1 changed files with 33 additions and 4 deletions
|
@ -392,10 +392,10 @@ a couple conversions.
|
||||||
(lists-transpose '((a b) (1 2 3) (#t)))
|
(lists-transpose '((a b) (1 2 3) (#t)))
|
||||||
]
|
]
|
||||||
|
|
||||||
As of 2022-03-31, Typed Racket cannot convert the type of
|
As of 2022-04-07, Typed Racket cannot convert the type of
|
||||||
@racket[lists-transpose] to a contract. To use @racket[lists-transpose] from
|
@racket[lists-transpose] to a contract. The @seclink["untyped"]{untyped
|
||||||
untyped code, require it from the @racket[untyped] submodule: @racket[(require
|
submodule} provides a version of this function which can be used in
|
||||||
(submod dds/utils untyped))].
|
untyped code.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,3 +516,32 @@ Converts 0 to @racket[#f] and 1 to @racket[#t].
|
||||||
(01->boolean 0)
|
(01->boolean 0)
|
||||||
(01->boolean 1)
|
(01->boolean 1)
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
@section[#:tag "untyped"]{Untyped code}
|
||||||
|
|
||||||
|
@defmodule[(submod dds/utils untyped)]
|
||||||
|
|
||||||
|
@(require (for-label (only-in racket/contract/base listof any/c)))
|
||||||
|
|
||||||
|
This submodule contains some functions whose types cannot be converted to
|
||||||
|
contracts by Typed Racket.
|
||||||
|
|
||||||
|
@(define utils-evaluator/untyped
|
||||||
|
(parameterize ([sandbox-output 'string]
|
||||||
|
[sandbox-error-output 'string]
|
||||||
|
[sandbox-memory-limit 50])
|
||||||
|
(make-evaluator 'racket #:requires '((submod "utils.rkt" untyped)))))
|
||||||
|
|
||||||
|
@defproc[(lists-transpose [lists (listof (listof any/c))])
|
||||||
|
(listof (listof any/c))]{
|
||||||
|
|
||||||
|
Transposes a list of lists. The length of the resulting list is the length of
|
||||||
|
the shortest list in @racket[lists].
|
||||||
|
|
||||||
|
This function is essentially @racket[in-parallel], wrapped in
|
||||||
|
a couple conversions.
|
||||||
|
|
||||||
|
@examples[#:eval utils-evaluator/untyped
|
||||||
|
(lists-transpose '((a b) (1 2)))
|
||||||
|
(lists-transpose '((a b) (1 2 3) (#t)))
|
||||||
|
]}
|
||||||
|
|
Loading…
Reference in a new issue