scheme - 如何将列表的每个元素检索为整数
scheme - how to retrieve each element of list as an integer
我对 scheme 很陌生,需要一点帮助。我想选择列表中的每个元素
作为一个整数并做一些处理。
(define (myfunc a b)
...
)
我将调用函数如下:
(myfunc '(1 2 3 4) '(1 2))
在 myfunc 中,我需要选择第二个列表中的每个元素作为整数并进行一些计算。感谢您的帮助。
(define (myfunc a-list indices)
(define (get i) (list-ref a-list i))
(map get indices))
(my-func '(1 2 3 4) '(1 2))
我对 scheme 很陌生,需要一点帮助。我想选择列表中的每个元素 作为一个整数并做一些处理。
(define (myfunc a b)
...
)
我将调用函数如下:
(myfunc '(1 2 3 4) '(1 2))
在 myfunc 中,我需要选择第二个列表中的每个元素作为整数并进行一些计算。感谢您的帮助。
(define (myfunc a-list indices)
(define (get i) (list-ref a-list i))
(map get indices))
(my-func '(1 2 3 4) '(1 2))