ここでのスキームは初めてです。スキーム関数をコンパイルしようとしていますrange
。それは非常に簡単です -とリストを取りstart
、すべての要素 = stepAmt + curStep である新しいリストを作成します。step
stop
L
例: (範囲 '(0 2 7)) => (0 2 4 6)、(範囲 '(2 2 0)) => ()
コンパイルしようとすると
(define (helper2(start stepAmt stop curStep newList)
(if (> start stop)
'()
(if (> (+ stepAmt curStep) stop)
newList
(helper2 (start stepAmt stop (+ stepAmt curStep) (concat newList (+stepAmt curStep))))))))
エラーが発生します
不正な特殊形式: (define helper2 (start stepamt stop curstep newlist) (if ... ... ...))
意味がわかりません。論理と括弧を再確認しましたが、わかりません。
これは、その関数を呼び出す関数です。
(define (example L)
(let (
(start (car L))
(curStep (car (cdr L)))
(step (car (cdr L)))
(stop (car (cdr (cdr L))))
)
(helper2 (start step stop curStep '()))
)
)
どんな指針も素晴らしいでしょう。タイプミスなのか論理エラーなのかわかりません。ありがとうございました!