Added types and tests for symbol operations

This commit is contained in:
Eric Dobson 2011-06-15 13:09:51 -04:00 committed by Sam Tobin-Hochstadt
parent ab23db7b5b
commit 4ba12dd20e
2 changed files with 38 additions and 4 deletions

View File

@ -0,0 +1,24 @@
#lang typed/racket
(: foo Symbol)
(: bar Symbol)
(define foo 'foo)
(define bar 'bar)
(symbol? foo)
(symbol? 2)
(symbol-interned? foo)
(symbol-interned? (string->unreadable-symbol "bar"))
(symbol-interned? (string->uninterned-symbol "bar"))
(symbol-interned? (gensym foo))
(symbol-unreadable? (gensym))
(symbol-unreadable? foo)
(symbol-unreadable? (string->unreadable-symbol "bar"))
(symbol-unreadable? (string->uninterned-symbol "bar"))
(symbol->string foo)
(string->symbol (symbol->string foo))

View File

@ -190,7 +190,6 @@
(Univ (make-pred-ty (list a) Univ b) . -> . b)
(-> (Un a (-val #f)) a)))]
[defined? (->* (list Univ) -Boolean : (-FS (-not-filter -Undefined 0 null) (-filter -Undefined 0 null)))]
[gensym (->opt [Sym] Sym)]
[open-input-string (-> -String -Input-Port)]
[open-input-bytes (-> -Bytes -Input-Port)]
@ -317,8 +316,21 @@
[string-join (-> (-lst -String) -String -String)]
;Section 3.6
[symbol? (make-pred-ty Sym)]
[symbol-interned? (-> Sym B)]
[symbol-unreadable? (-> Sym B)]
[symbol->string (Sym . -> . -String)]
[string->symbol (-String . -> . Sym)]
[string->uninterned-symbol (-String . -> . Sym)]
[string->unreadable-symbol (-String . -> . Sym)]
[gensym (->opt [Sym] Sym)]
[keyword? (make-pred-ty -Keyword)]
[list? (make-pred-ty (-lst Univ))]
[list (-poly (a) (->* '() a (-lst a)))]
@ -547,8 +559,6 @@
[match:error ((list) Univ . ->* . (Un))]
[string->symbol (-String . -> . Sym)]
[symbol->string (Sym . -> . -String)]
[string->keyword (-String . -> . -Keyword)]
[keyword->string (-Keyword . -> . -String)]