Switch functions entirely to Typed Racket.

This commit is contained in:
Sergiu Ivanov 2022-04-25 23:55:32 +02:00
parent 0e2b91fdd1
commit 9182ea9ecb
2 changed files with 602 additions and 622 deletions

View File

@ -1,4 +1,4 @@
#lang racket #lang typed/racket
;;; dds/functions ;;; dds/functions
@ -9,7 +9,6 @@
(require "utils.rkt") (require "utils.rkt")
(module typed typed/racket
(require "utils.rkt" (require "utils.rkt"
syntax/parse/define typed/racket/stream syntax/parse/define typed/racket/stream
(only-in typed/racket/unsafe unsafe-provide) (only-in typed/racket/unsafe unsafe-provide)
@ -646,22 +645,3 @@
(check-equal? (tabulate*/01 `(,(λ (x y) (min x y)) ,(λ (x y) (max x y)))) (check-equal? (tabulate*/01 `(,(λ (x y) (min x y)) ,(λ (x y) (max x y))))
'((0 0 0 0) (0 1 0 1) (1 0 0 1) (1 1 1 1))))) '((0 0 0 0) (0 1 0 1) (1 0 0 1) (1 1 1 1)))))
) )
)
(require 'typed)
(provide
pseudovariadic-lambda pvλ pseudovariadic-define pvdefine
tabulate* tabulate*/strict tabulate*/pv
tabulate tabulate/strict tabulate/pv
tabulate*/pv/boolean tabulate/pv/boolean
tabulate*/pv/01 tabulate/pv/01
tabulate*/list tabulate/list
tabulate*/list/boolean tabulate/list/boolean tabulate*/list/01 tabulate/list/01
table->function/list table->function table->function/pv
enumerate-boolean-tables enumerate-boolean-functions
enumerate-boolean-functions/pv enumerate-boolean-functions/list
random-boolean-table random-boolean-function random-boolean-function/list
(struct-out tbf) tbf-w tbf-θ boolean->01/vector apply-tbf apply-tbf/boolean
list->tbf lists->tbfs read-org-tbfs tbf-tabulate* tbf-tabulate
tbf-tabulate*/boolean sbf? sbf list->sbf read-org-sbfs)

View File

@ -8,7 +8,7 @@
(parameterize ([sandbox-output 'string] (parameterize ([sandbox-output 'string]
[sandbox-error-output 'string] [sandbox-error-output 'string]
[sandbox-memory-limit 50]) [sandbox-memory-limit 50])
(make-evaluator 'typed/racket #:requires '((submod "functions.rkt" typed))))) (make-evaluator 'typed/racket #:requires '("functions.rkt"))))
@(define-syntax-rule (ex . args) @(define-syntax-rule (ex . args)
(examples #:eval functions-evaluator . args)) (examples #:eval functions-evaluator . args))
@ -610,10 +610,10 @@ See also @racket[read-org-tbfs].
} }
@section[#:tag "fuctions/untyped"]{Untyped definitions} @section[#:tag "fuctions/untyped"]{Untyped definitions}
@defmodule[(submod dds/functions typed untyped)] @defmodule[(submod dds/functions untyped)]
@(require (for-label (only-in racket/contract/base listof any/c) @(require (for-label (only-in racket/contract/base listof any/c)
(for-label (only-in (submod "../functions.rkt" typed untyped) (for-label (only-in (submod "../functions.rkt" untyped)
tabulate/boolean tabulate*/boolean tabulate/boolean tabulate*/boolean
tabulate/01 tabulate*/01)))) tabulate/01 tabulate*/01))))
@ -632,7 +632,7 @@ accompanied by the explicit mention "untyped".
(parameterize ([sandbox-output 'string] (parameterize ([sandbox-output 'string]
[sandbox-error-output 'string] [sandbox-error-output 'string]
[sandbox-memory-limit 50]) [sandbox-memory-limit 50])
(make-evaluator 'racket #:requires '((submod "functions.rkt" typed untyped))))) (make-evaluator 'racket #:requires '((submod "functions.rkt" untyped)))))
@(define-syntax-rule (ex/untyped . args) @(define-syntax-rule (ex/untyped . args)
(examples #:eval functions-evaluator/untyped . args)) (examples #:eval functions-evaluator/untyped . args))