2014-03-27 30 views
0

在鍵入的球拍,爲什麼string-normalize-whitespace類型檢查關鍵字arg?

`(: collapse ((Listof Expansion) -> Expansion)) 
    ; flatten a list of expansions into a single expansion representing the whole thing-- 
    (define (collapse expansions) 
    (letrec: ([token : String (foldl (λ: ([e : Expansion] [working : String]) (string-append working (token-of e))) "" expansions)] 
     [normalized-token : String (string-normalize-spaces token)] 
     [lexicon : Lexicon (foldl (λ: ([e : Expansion] [working : Lexicon]) 
            (merge-lexica working (lexicon-of e))) 
          (empty-lexicon) 
          expansions)]) 
     (make-expansion token lexicon)))` 

這給了我

Type Checker: Expected String, but got (case-> (String [#:repeat? Any] [#:trim? Any] -> String) (String (U Regexp String) [#:repeat? Any] [#:trim? Any] -> String) (String (U Regexp String) String [#:repeat? Any] [#:trim? Any] -> String)) in: (string-normalize-spaces token #:trim #f)

這將檢查出的罰款,如果我刪除了關鍵字ARG(雖然,當然,那麼它不實際上做我想做的事情)。

升級到最新版本(令人震驚!)改進的事項 - 解決了我的require問題,但我顯然仍然缺少一些東西。

+1

你可以發佈一個更完整的代碼示例嗎?很難從第一個片段中知道發生了什麼(並且很難重現)。此外,在Racket v6.0中,'string-normalize-spaces'函數應該帶有一個類型,所以你不需要使用'require/typed'。 –

+0

剛剛檢查並看到我在舊版本的球拍上,所以我現在正在更新,也許就是這樣! – Ben

+0

類型球拍不是計劃;建議刪除Scheme標籤。 – GoZoner

回答

1

升級到球拍6.0並刪除require,消除了錯誤。

相關問題