seasoned-schemer

The Seasoned Schemer, letcc and guile

≡放荡痞女 提交于 2020-01-10 19:16:12
问题 A few questions here, regarding letcc that is used in The Seasoned Schemer. (define (intersect-all sets) (letcc hop (letrec ((A (lambda (sets) (cond ((null? (car sets)) (hop '()) ((null? (cdr sets)) (car sets)) (else (intersect (car sets) (A (cdr sets))))))) ; definition of intersect removed for brevity (cond ((null? sets) '()) (else (A sets)))))) I think I understand what letcc achieves, and that is basically something like catch and throw in ruby (and seemingly CL), which basically means a

The Seasoned Schemer, letcc and guile

强颜欢笑 提交于 2020-01-10 19:16:04
问题 A few questions here, regarding letcc that is used in The Seasoned Schemer. (define (intersect-all sets) (letcc hop (letrec ((A (lambda (sets) (cond ((null? (car sets)) (hop '()) ((null? (cdr sets)) (car sets)) (else (intersect (car sets) (A (cdr sets))))))) ; definition of intersect removed for brevity (cond ((null? sets) '()) (else (A sets)))))) I think I understand what letcc achieves, and that is basically something like catch and throw in ruby (and seemingly CL), which basically means a

Seasoned Schemer's get-first, get-next, and waddle functions

你。 提交于 2020-01-02 05:06:05
问题 (define get-first (lambda (l) (call-with-current-continuation (lambda (here) (set! leave here) (waddle l) (leave (quote ())))))) (define get-first (lambda (l) (call-with-current-continuation (lambda (here) (set! leave here) (leave (waddle l)))))) For anybody not familiar with the book "The Seasoned Schemer", get-first , get-next , and waddle (last two not defined here) are procedures to apparently model coroutines to iterate through a tree passed to waddle that yields leaves only. Just prior

The Seasoned Schemer, letcc and guile

亡梦爱人 提交于 2019-11-30 13:47:56
A few questions here, regarding letcc that is used in The Seasoned Schemer. (define (intersect-all sets) (letcc hop (letrec ((A (lambda (sets) (cond ((null? (car sets)) (hop '()) ((null? (cdr sets)) (car sets)) (else (intersect (car sets) (A (cdr sets))))))) ; definition of intersect removed for brevity (cond ((null? sets) '()) (else (A sets)))))) I think I understand what letcc achieves, and that is basically something like catch and throw in ruby (and seemingly CL), which basically means a whole block of code can be cut short by calling whatever the named letcc is. This feels like the least