utils: Remove type annotations.
I am very early in my project, and I have already spent literal days trying to make the types fit together. I'm trying contracts next.
This commit is contained in:
parent
9cbfcfca4b
commit
404362a91c
3 changed files with 7 additions and 14 deletions
4
bn.rkt
4
bn.rkt
|
@ -1,4 +1,4 @@
|
|||
#lang typed/racket
|
||||
#lang racket
|
||||
|
||||
;;; dds/bn
|
||||
|
||||
|
@ -10,8 +10,6 @@
|
|||
(require "utils.rkt")
|
||||
|
||||
(provide
|
||||
;; Types
|
||||
Variable State UpdateFunc Network
|
||||
;; Functions
|
||||
update make-state make-bn-funcs update-func-form->update-func
|
||||
bn-form->bn make-bn-forms
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#lang typed/racket
|
||||
#lang racket
|
||||
|
||||
;;; Tests for dds/utils.
|
||||
|
||||
(require typed/rackunit "utils.rkt")
|
||||
(require rackunit "utils.rkt")
|
||||
|
||||
(test-case "HashTable Injection"
|
||||
(test-case "auto-hash-ref/explicit"
|
||||
|
|
13
utils.rkt
13
utils.rkt
|
@ -1,4 +1,4 @@
|
|||
#lang typed/racket
|
||||
#lang racket
|
||||
|
||||
;;; dds/utils
|
||||
|
||||
|
@ -96,16 +96,14 @@
|
|||
;;; [z 1])
|
||||
;;; (eval-with ht '(+ b z a 1)))
|
||||
;;;
|
||||
(: eval-with (-> (HashTable Symbol Any) Any AnyValues))
|
||||
(define (eval-with ht expr)
|
||||
(parameterize ([current-namespace (current-namespace)])
|
||||
(parameterize ([current-namespace (make-base-namespace)])
|
||||
(hash-for-each ht (lambda (x val)
|
||||
(namespace-set-variable-value! x val)))
|
||||
(eval expr)))
|
||||
|
||||
;;; Same as eval-with, but returns only the first value produced by
|
||||
;;; the evaluated expression.
|
||||
(: eval-with1 (-> (HashTable Symbol Any) Any Any))
|
||||
(define (eval-with1 ht expr)
|
||||
(let ([vals (call-with-values (λ () (eval-with ht expr))
|
||||
(λ vals vals))])
|
||||
|
@ -118,13 +116,10 @@
|
|||
|
||||
;;; Produces a list of symbols appearing in the quoted expression
|
||||
;;; passed in the first argument.
|
||||
(: extract-symbols (-> Any (Listof Symbol)))
|
||||
(define (extract-symbols form)
|
||||
(cond
|
||||
[(symbol? form)
|
||||
(list (cast form Symbol))]
|
||||
(list form)]
|
||||
[(list? form)
|
||||
(cast (flatten (for/list : (Listof (Listof Symbol))
|
||||
([x (cast form (Listof Any))])
|
||||
(extract-symbols x))) (Listof Symbol))]
|
||||
(flatten (for/list ([x form]) (extract-symbols x)))]
|
||||
[else '()]))
|
||||
|
|
Loading…
Reference in a new issue