diff --git a/networks.rkt b/networks.rkt index ab0d98c..a620278 100644 --- a/networks.rkt +++ b/networks.rkt @@ -10,7 +10,8 @@ ;;; This model can generalise Boolean networks, TBANs, multivalued ;;; networks, etc. -(require "utils.rkt" "generic.rkt" "functions.rkt" +(require (except-in "utils.rkt" lists-transpose) (submod "utils.rkt" untyped) + "generic.rkt" "functions.rkt" graph racket/random racket/hash) (provide @@ -951,14 +952,6 @@ ;;; Constructing functions and networks ;;; =================================== -;;; TODO 2022-02-13: Remove when this module is completely migrated to -;;; Typed Racket. -;;; -;;; Typed Racket cannot generate the contract from the type of -;;; lists-transpose in utils. This is a copy of lists-transpose. -(define (lists-transpose lists) - (sequence->list (in-values-sequence (apply in-parallel lists)))) - ;;; Given a table like the one produced by tabulate-network, ;;; constructs a Boolean network having this behaviour. If headers is ;;; #t, considers that the first element of the list are the headers diff --git a/scribblings/utils.scrbl b/scribblings/utils.scrbl index 9e36df7..7d4e9c1 100644 --- a/scribblings/utils.scrbl +++ b/scribblings/utils.scrbl @@ -390,7 +390,14 @@ a couple conversions. @examples[#:eval utils-evaluator (lists-transpose '((a b) (1 2))) (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))]. + +} @defproc[(append-lists [lsts (Listof (List (Listof a) (Listof a)))]) (Listof (Listof a))]{ diff --git a/utils.rkt b/utils.rkt index 0602978..9d2545f 100644 --- a/utils.rkt +++ b/utils.rkt @@ -438,6 +438,11 @@ (define (lists-transpose lists) (sequence->list (in-values-sequence (apply in-parallel lists)))) +(module untyped racket + (provide (contract-out [lists-transpose (-> (listof (listof any/c)) (listof (listof any/c)))])) + (define (lists-transpose lists) + (sequence->list (in-values-sequence (apply in-parallel lists))))) + (module+ test (test-case "lists-transpose" (check-equal? (lists-transpose '((1 2) (a b))) '((1 a) (2 b)))))