CS/SICP in JS

연습문제 2.17

띵킹 2023. 2. 26. 14:55
function last_pair(items){
    return is_null(tail(items))
           ? items
           : last_pair(tail(items));
}

꼬리를 돌려주면서 꼬리의 꼬리가 null이면 그대로 꼬리를 반환한다.

728x90

'CS > SICP in JS' 카테고리의 다른 글

연습문제 2.21  (0) 2023.02.27
연습문제 2.20  (0) 2023.02.26
연습문제 2.2  (0) 2023.02.21
연습문제 2.1  (0) 2023.02.21
연습문제 1.42  (0) 2023.02.20