From 404362a91cecd6f014e1add50230ccfea8202da8 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Wed, 19 Feb 2020 22:49:50 +0100 Subject: [PATCH] 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. --- bn.rkt | 4 +--- utils-tests.rkt | 4 ++-- utils.rkt | 13 ++++--------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/bn.rkt b/bn.rkt index f7eb2ac..dd2184f 100644 --- a/bn.rkt +++ b/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 diff --git a/utils-tests.rkt b/utils-tests.rkt index acd9677..d1855ad 100644 --- a/utils-tests.rkt +++ b/utils-tests.rkt @@ -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" diff --git a/utils.rkt b/utils.rkt index 7e2c998..9fc5237 100644 --- a/utils.rkt +++ b/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 '()]))