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
問題,但我顯然仍然缺少一些東西。
你可以發佈一個更完整的代碼示例嗎?很難從第一個片段中知道發生了什麼(並且很難重現)。此外,在Racket v6.0中,'string-normalize-spaces'函數應該帶有一個類型,所以你不需要使用'require/typed'。 –
剛剛檢查並看到我在舊版本的球拍上,所以我現在正在更新,也許就是這樣! – Ben
類型球拍不是計劃;建議刪除Scheme標籤。 – GoZoner