Add the untyped submodule to utils.

This commit is contained in:
Sergiu Ivanov 2022-04-01 00:09:42 +02:00
parent 1e4f6d3fbc
commit 650801a6d2
3 changed files with 15 additions and 10 deletions

View file

@ -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

View file

@ -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))]{

View file

@ -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)))))