Đang chuẩn bị liên kết để tải về tài liệu:
An Introduction to Programming in Emacs Lisp phần 8

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Giá trị trả về bởi các chức năng như một toàn thể sẽ là 6. Bây giờ chúng ta biết những gì sẽ xảy ra khi tam giác-đệ quy được gọi với một đối số 3, nó là rõ ràng những gì sẽ xảy ra nếu nó được gọi với một đối số 4: Trong các cuộc gọi đệ quy, đánh giá | Counting function definitions 201 The function is straightforward except for one subtle feature. The true-or-false test of the inner loop looks like this and car sorted-lengths car sorted-lengths top-of-range instead of like this car sorted-lengths top-of-range The purpose of the test is to determine whether the first item in the sorted-lengths list is less than the value of the top of the range. The simple version of the test works fine unless the sorted-lengths list has a nil value. In that case the car sorted-lengths expression function returns nil. The function cannot compare a number to nil which is an empty list so Emacs signals an error and stops the function from attempting to continue to execute. The sorted-lengths list always becomes nil when the counter reaches the end of the list. This means that any attempt to use the defuns-per-range function with the simple version of the test will fail. We solve the problem by using the car sorted-lengths expression in conjunction with the and expression. The car sorted-lengths expression returns a non-nil value so long as the list has at least one number within it but returns nil if the list is empty. The and expression first evaluates the car sorted-lengths expression and if it is nil returns false without evaluating the expression. But if the car sorted-lengths expression returns a non-nil value the and expression evaluates the expression and returns that value as the value of the and expression. This way we avoid an error. See Section 12.4 forward-paragraph a Goldmine of Functions page 155 for more information about and. Here is a short test of the defuns-per-range function. First evaluate the expression that binds a shortened top-of-ranges list to the list of values then evaluate the expression for binding the sorted-lengths list and then evaluate the defuns-per-range function. Shorter list than we will use later. setq top-of-ranges 110 120 130 140 150 160 170 180 190 200 setq sorted-lengths 85 86 110 116 122 .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.