オンラインでSchemeの簡単な紹介を見つけましたが、この機能に少し問題があります。
(define (title-style str)
(let loop ((lc #\space) (i 0) (c (string-ref str 0)))
((if (char=? lc #\space)
(string-set! str i (char-upcase c)))
(if (= (- (string-length str) 1) i)
str
(loop c (+ i 1) (string-ref str (+ i 1)))))))
(display "star wars iv: a new hope")
(display (title-style "star wars iv: a new hope"))
呼び出してみると、次のようになります。
Error: call of non-procedure: #<unspecified>
Call history:
title-style.scm:6: loop
...
title-style.scm:1: g6 <--
そのエラーはチキンスキームから来ています.Chezスキームでも同じ結果が得られています.
文字列をタイトルの大文字と小文字に変換し、以前に取得したエラー メッセージから、次のようにします。call of non-procedure: "Star Wars Iv: A New Hope"