我正试图计算列表中所有中间值的总和。我的代码如下,但它不起作用。 (: sums : (Listof Integer) -> (Listof Integer))
;; compute the sum of a list,
;; produce all the intermediate sums along the way
;; start with 0
;; (sums (list 1 2
我写了下面的功能find-index在列表中搜索:现在 (: finind : (Listof Integer) Integer -> (Option Integer))
;; helper function for find-index
(define (finind a b)
(let loop ((a a) (c 0))
(cond
((empty? a