logo

Fix Indentation: Graham's Code

   

Added on  2019-09-16

5 Pages1563 Words368 Views
 | 
 | 
 | 
The first thing you have to do is set the lisp critique and tests. Follow the instructions in ‘Lisp Critique and Tests’. To see if you installed correctly, I have provided the example and output below. Lisp Critique and Testshttp://www.cs.northwestern.edu/academics/courses/325/admin/lisp-setup.phpHere is what you should getCS325-USER 2 > (critique (defun foo (x) (setq x (+ x 1))))----------------------------------------------------------------------INCF would be simpler to add 1 to X than SETQ----------------------------------------------------------------------It's bad style to reassign input parameters like X -- and oftenuseless.----------------------------------------------------------------------Don't use (+ X 1), use (1+ X) for its value or (INCF X) to change X,whichever is appropriate here.----------------------------------------------------------------------CS325-USER 3 > (get-tests)(3TREE-CLONE 3TREE-MEMBER ?IS-A ABSTS-ABSTP ALIST->HASH-TABLE BIGGER-ARG BIN-SEARCH BST-ELEMENTS CAR-CIRCULAR-P CDR-CIRCULAR-P CIRCULAR-MEMBER-P COLLECT-NUMBERS COMMON-ABSTS COPY-QUEUE DELETE-CAR DIFF-BY-ONE-P DOUBLEF EMPTY-QUEUE-P ENQUEUE-FRONT EVERY-RANGE EXTRACT-CODE-FROM-STREAM FIND-RANGE FUNCTIONS-REFERENCED GET-A-COUNT GREATER GREATEST-ARG HAS-LIST-P HAS-NUMBER-P HASH-TABLE->ALIST HENLEY-P HORNER INTERSECT INTERSECT-SEGMENTS INTERSPERSE KEY-IF LIST-OF LONGEST-PATH MAKE-BALANCE MAKE-BEST-CHANGE MAKE-CHANGE MAKE-QUEUE MAP-RANGE MAP-STREAM MAX-MIN MEMBER-MATCH MEMOIZE MY-COPY-LIST MY-REMOVE-IF MY-REVERSE N-OF NORMAL NROTATE-ARRAY NTH-EXPR OCCURRENCES POSITION+ PRECEDERS PRESERVE PRINT-DOTS REDUCE-TREE REQUEUE-FRONT RING-PACKAGE ROTATE-ARRAY SHORTEST-PATH SHOW-DOTS SHOW-LIST SOLVE STABLE-INTERSECTION STABLE-SET-DIFFERENCE STABLE-UNION STREAM-SUBST SUMMIT TCONC TEST-TAKING-MATCH TOKENIZER TWO-MOST WITH-COLLECTOR)This is the textbook for the various exercises. The Textbookhttps://7chan.org/pr/src/ANSI_Common_Lisp_-_Paul_Graham.pdf
Fix Indentation: Graham's Code_1

Here are helpful websites that contain partially / mostly completed answers. Helpful Websiteshttp://www.shido.info/lisp/pacl2_e.html#symbolhttps://github.com/pdelong42/ANSI_Common_Lisp-solutionshttps://github.com/ffilozov/ANSI-Common-Lisphttps://github.com/ryuk/ansi-common-lisp-exercisesHere is the exercise list. You can see that the exercises have been slightly changed from the textbook versions. Exercise listhttps://www.cs.northwestern.edu/academics/courses/325/exercises/exercises.phpBelow are the exercises to do in the textbook (make sure to take ‘Exercise list’ into account). The exercises first need to pass the tests and then the critique. For example, pretend you have created the read-stream function in 8-5:(defun read-stream (input.... )))First (run-tests read-stream) must be passedSecond (critique(defun read-stream (input.... ))) )Must be passedNext, the assignment is submitted and the professor usually comes back with a few comments. Exercises to do (Graham)Do Lisp: 10, 11, 12, 13Do Graham: 7-2, 7-5+6, 8-5, 9-5, 9-6, 10-3+5, 10-8Fix Graham comments: 3-9, 5-9Fix Indentation: Graham 4-4 and 10-6Matcher: 1, 2Other: Triple query filter, Make Best Change, Insert Segments, camelize & hyphenate* Fix indentation for 4-4 and 10-6 below.* I have notes for Graham 3-9 and 5-9 below. ;4-4 – fix indentation(defun bst-elements (bst)
Fix Indentation: Graham's Code_2

End of preview

Want to access all the pages? Upload your documents or become a member.