开发者

Sum a list without recursion/looping in Scheme/Racket

I'm working on an assignment involving Racket and I was hoping somebody could lead me into the right direction.

I must calculate the norm of a list without recursion or using a loop and without defining any helper functions.

Is this possible? The only thing that comes to mind is to someh开发者_开发知识库ow use the built-in map functions


(define (norm lst)
  (apply + (map square lst)))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜