Add the untyped submodule to utils.
This commit is contained in:
parent
1e4f6d3fbc
commit
650801a6d2
3 changed files with 15 additions and 10 deletions
11
networks.rkt
11
networks.rkt
|
@ -10,7 +10,8 @@
|
||||||
;;; This model can generalise Boolean networks, TBANs, multivalued
|
;;; This model can generalise Boolean networks, TBANs, multivalued
|
||||||
;;; networks, etc.
|
;;; 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)
|
graph racket/random racket/hash)
|
||||||
|
|
||||||
(provide
|
(provide
|
||||||
|
@ -951,14 +952,6 @@
|
||||||
;;; Constructing functions and networks
|
;;; 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,
|
;;; Given a table like the one produced by tabulate-network,
|
||||||
;;; constructs a Boolean network having this behaviour. If headers is
|
;;; constructs a Boolean network having this behaviour. If headers is
|
||||||
;;; #t, considers that the first element of the list are the headers
|
;;; #t, considers that the first element of the list are the headers
|
||||||
|
|
|
@ -390,7 +390,14 @@ a couple conversions.
|
||||||
@examples[#:eval utils-evaluator
|
@examples[#:eval utils-evaluator
|
||||||
(lists-transpose '((a b) (1 2)))
|
(lists-transpose '((a b) (1 2)))
|
||||||
(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
|
||||||
|
@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)))])
|
@defproc[(append-lists [lsts (Listof (List (Listof a) (Listof a)))])
|
||||||
(Listof (Listof a))]{
|
(Listof (Listof a))]{
|
||||||
|
|
|
@ -438,6 +438,11 @@
|
||||||
(define (lists-transpose lists)
|
(define (lists-transpose lists)
|
||||||
(sequence->list (in-values-sequence (apply in-parallel 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
|
(module+ test
|
||||||
(test-case "lists-transpose"
|
(test-case "lists-transpose"
|
||||||
(check-equal? (lists-transpose '((1 2) (a b))) '((1 a) (2 b)))))
|
(check-equal? (lists-transpose '((1 2) (a b))) '((1 a) (2 b)))))
|
||||||
|
|
Loading…
Reference in a new issue