From b1613ac1f794bbbdcd65661164b55cb8c38ef66a Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Thu, 7 Apr 2022 00:21:48 +0200 Subject: [PATCH] utils: Explicitly document the untyped submodule. --- scribblings/utils.scrbl | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/scribblings/utils.scrbl b/scribblings/utils.scrbl index 7d4e9c1..83d4428 100644 --- a/scribblings/utils.scrbl +++ b/scribblings/utils.scrbl @@ -392,10 +392,10 @@ a couple conversions. (lists-transpose '((a b) (1 2 3) (#t))) ] -As of 2022-03-31, Typed Racket cannot convert the type of -@racket[lists-transpose] to a contract. To use @racket[lists-transpose] from -untyped code, require it from the @racket[untyped] submodule: @racket[(require -(submod dds/utils untyped))]. +As of 2022-04-07, Typed Racket cannot convert the type of +@racket[lists-transpose] to a contract. The @seclink["untyped"]{untyped +submodule} provides a version of this function which can be used in +untyped code. } @@ -516,3 +516,32 @@ Converts 0 to @racket[#f] and 1 to @racket[#t]. (01->boolean 0) (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))) +]}