Reddit reviews Scheme and the Art of Programming
We found 2 Reddit comments about Scheme and the Art of Programming. Here are the top ones, ranked by their Reddit score.
We found 2 Reddit comments about Scheme and the Art of Programming. Here are the top ones, ranked by their Reddit score.
Some context, I've been living in this house for about 3 years now, my girlfriend and i moved in to take care of the owner of the house. Turns out that he was a big lisp / scheme hacker back in the 80s-90s and had developed a lot of cutting edge tech in his hay day. Anyway, these books have been hiding in his library downstairs...
It was like finding a bunch of hidden magical scrolls of lost knowledge :)
edit: I will compile a list of the books later. I'm out doing 4th of July things.
update: List of books
ISBN: 1-55558-044-0
ISBN: 1-55558-042-4
ISBN: 0-262-56038-0
ISBN: 0-393-95544-3
ISBN: 0-201-17589-4
ISBN: 0-07-000-422-6
ISBN: 0-13-370875-6
ISBN: 0-07-054666-5
ISBN: 0-262-11158-6
ISBN: 1-55860-191-0
ISBN: 1-59059-239-5
ISBN: 0-932376-41-X
ISBN: 0-07-001115-X
ISBN: 0-673-39773-4
ISBN: 0-262-07093-6
ISBN: 0-932376-87-8
ISBN: 0-13-717232-X
ISBN: 0-417-50308-8
ISBN: 0-471-60771-1
ISBN: 0-262-19288-8
ISBN: 0-262-55017-2
ISBN: 0-13-834284-9
ISBN: 1-935182-64-1
ISBN: 978-1-59327-591-4
Well, I don't have a reference, I have a Scheme program I wrote back in college to do it (borrowing heavily from Springer/Friedman):
;
;This function tests to see if the next attempted move (try)
;is legal, given the list that has been constructed thus far
;(if any) - legal-pl (LEGAL PLacement list)
;N.B. - this function is an EXACT copy of the one from
;Springer and Friedman
(define legal?
(lambda (try legal-pl)
(letrec
((good?
(lambda (new-pl up down)
(cond
((null? new-pl) #t)
(else (let ((next-pos (car new-pl)))
(and
(not (= next-pos try))
(not (= next-pos up))
(not (= next-pos down))
(good? (cdr new-pl)
(add1 up)
(sub1 down)))))))))
(good? legal-pl (add1 try) (sub1 try)))))
;
;This function tests the length of the solution to
;see if we need to continue "cons"ing on more terms
;or not given to the specified board size.
;
;I modified this function so that it could test the
;validity of any solution for a given boardsize.
(define solution?
(lambda (legal-pl boardsize)
(= (length legal-pl) boardsize)))
;
;I had to modify this function so that it was passed
;the boardsize in its call, but other than that (and
;simply replacing "fresh-start" with boardsize), just
;about no changes were made. This function simply
;generates a solution.
(define build-solution
(lambda (legal-pl boardsize)
(cond
((solution? legal-pl boardsize) legal-pl)
(else (forward boardsize legal-pl boardsize)))))
;
;This function dictates how the next solution will be
;chosen, as it is only called when the last solution
;was proven to be legal, and we are ready to try a new
;placement.
;
;I had to modify this function to include the boardsize
;as well, since it invokes "build-solution".
(define forward
(lambda (try legal-pl boardsize)
(cond
((zero? try) (backtrack legal-pl boardsize))
((legal? try legal-pl) (build-solution (cons try legal-pl) boardsize))
(else (forward (sub1 try) legal-pl boardsize)))))
;
;This function is used when the last move is found to
;be unhelpful (although valid) - instead it tries another
;one until it finds a new solution.
;
;Again, I had to modify this function to include boardsize
;since it calls "forward", which has boardsize as a
;parameter due to the "build-solution" call within it
(define backtrack
(lambda (legal-pl boardsize)
(cond
((null? legal-pl) '())
(else (forward (sub1 (car legal-pl)) (cdr legal-pl) boardsize)))))
;
;This is pretty much the same function as the one in the book
;with just my minor "boardsize" tweaks, since build-solution
;is called.
(define build-all-solutions
(lambda (boardsize)
(letrec
((loop (lambda (sol)
(cond
((null? sol) '())
(else (cons sol (loop (backtrack sol boardsize))))))))
(loop (build-solution '() boardsize)))))
;_____
;This function I made up entirely myself, and I only
;made it really to satisfy the syntactical limitations
;of the laboratory instructions. This makes it so that
;the input of "(queens 4)" will return a list of the
;two possible configurations that are valid solutions,
;even though my modifiend functions would return the same
;value by simply inputting "(build-all-solutions 4)".
(define queens
(lambda (n)
(build-all-solutions n)))
Complete with comments and all. All of the references to "the book" refer to this book