체계에서 루프가 작동하는 방식을 이해하는 데 어려움이 있습니다. 이 코드는 실행되지만 특히for 루프는 어떻게 작동합니까?
(define (bubblesort alist)
;; this is straightforward
(define (swap-pass alist)
(if (eq? (length alist) 1)
alist
(let ((fst (car alist)) (scnd (cadr alist)) (rest (cddr alist)))
(if (> fst scnd)
(cons scnd (swap-pass (cons fst rest)))
(cons fst (swap-pass (cons scnd rest)))))))
; this is mysterious--what does the 'for' in the next line do?
(let for ((times (length alist))
(val alist))
(if (> times 1)
(for (- times 1) (swap-pass val))
(swap-pass val))))
내가 (let for ((
가 여기서 할 예정이다 알아낼 수없는 이유를 모르겠어요, 그리고 마지막 줄에 두 번째의 for
표현도 넣어 조금 떨어져있다 - 저는 통역사가 for
이 단 하나의 논점만을 취하고 있다고 불평했지만, 여기에는 두 가지가 있습니다.
여기에 무슨 일이 일어나고 있는지에 대한 의견이 있으십니까?
많은 감사의 말로 설명 된대로 let이라는 이름이 확장되었습니다. 지금은 나에게 훨씬 더 의미가 있습니다. –