Fix 14 wave-4 re-review findings (batches w4a+w4b)
This commit is contained in:
1 parent
a28a35991f
commit
fd5e11cdeb
23 files changed
+98
-29
No files matched your search
@@ -190,7 +190,7 @@ Good luck - and keep a REPL open. That's the Lisp way!")
|
||||
:hint "FIND returns the element, POSITION its index, COUNT the matches: (position 'b '(a b c)) => 1. :test decides what matches; the default treats 1 and 1.0 as different, so use (find x xs :test #'=).")
|
||||
(:name "sequences2"
|
||||
:dir "19_sequences"
|
||||
:hint "REMOVE drops matches: (remove x xs), mind the argument order. REMOVE-IF drops what its predicate accepts. SUBSTITUTE reads (NEW OLD SEQUENCE). EVERY wants the predicate true of all elements; SOME settles for one.")
|
||||
:hint "REMOVE drops matches: (remove x xs), mind the argument order. REMOVE-IF drops what its predicate accepts. SUBSTITUTE reads (NEW OLD SEQUENCE).")
|
||||
(:name "sequences3"
|
||||
:dir "19_sequences"
|
||||
:hint "SORT takes the comparison first: (sort (list 3 1 2) #'<). With :key it compares one part of each element: (sort pairs #'< :key #'cdr). REVERSE returns a backwards copy - MAPCAR it over each word.")
|
||||
@@ -251,7 +251,7 @@ Good luck - and keep a REPL open. That's the Lisp way!")
|
||||
:hint "DO steps every variable with the OLD values, like LET - so TOTAL's step must be (+ total i). DO* steps one at a time like LET*, and B's step (* b a) then sees A's NEW value - swap the factorial's DO for DO* and it multiplies the right pairs.")
|
||||
(:name "loops6"
|
||||
:dir "10_loops"
|
||||
:hint "COUNT wants a test: (loop for x in xs count (oddp x)). MAXIMIZE tracks the biggest: (loop for x in xs maximize x), NIL when the loop never runs. For the wallet LOOP-FINISH bails out before the total goes over: (if (> (+ total x) limit) (loop-finish) (setf total (+ total x))), and FINALLY returns the total either way.")
|
||||
:hint "COUNT wants a test: (loop for x in xs count (oddp x)). MAXIMIZE tracks the biggest: (loop for x in xs maximize x) - but what an empty run answers is implementation-dependent (0 in SBCL), so WIDEST must answer NIL itself when XS is empty. For the wallet LOOP-FINISH bails out before the total goes over: (if (> (+ total x) limit) (loop-finish) (setf total (+ total x))), and FINALLY returns the total either way.")
|
||||
(:name "num1"
|
||||
:dir "11_numbers"
|
||||
:hint "Drop the 2.0: (expt 2 100) and (/ 7 2) stay exact when all arguments are integers.")
|
||||
@@ -302,7 +302,7 @@ Good luck - and keep a REPL open. That's the Lisp way!")
|
||||
:hint "Name the package: (find-symbol name 'attic) - with no package argument it searches *package* and finds nothing. INTERN makes-or-finds: (intern name 'attic) answers with the symbol either way, so (symbol-name (attic-intern \"SPARE-KEY\")) is \"SPARE-KEY\".")
|
||||
(:name "pkg5"
|
||||
:dir "14_packages"
|
||||
:hint "The double colon reaches internals: shop::secret-sale. For the clash, add (:shadow #:fill) to the defpackage - then FILL inside POST-OFFICE means POST-OFFICE's own, and COMMON-LISP's FILL still fills sequences, which the third check relies on. The nickname STORE reaches SHOP the single-colon way.")
|
||||
:hint "The double colon reaches internals: shop::secret-sale. Add (:shadow #:fill) to the defpackage: POST-OFFICE claims FILL as its own symbol up front, and the DEFUN below defines that one. Without the claim, plain FILL inside POST-OFFICE reads as COMMON-LISP's, and SBCL's package lock stops the file from loading. CL:FILL itself stays untouched - the third check still calls it from CL-USER. The nickname STORE reaches SHOP the single-colon way.")
|
||||
(:name "clos1"
|
||||
:dir "15_clos"
|
||||
:hint "MAKE-INSTANCE with initargs: (make-instance 'dog :name \"Rex\" :tricks '(\"sit\" \"roll-over\")). Initargs are keywords named after the slots.")
|
||||
|
||||
Reference in new issue
Block a user