swap!, reverse!, sort!, sort-by!, index-of, min-of, max-of, map!, reduce and filter, each written once over $t. Every call site in the corpus moves with them. min-of and max-of are not min and max because min and max are builtins over two or more numbers and nothing shadows a builtin. These reduce a slice, which is a different operation at a different arity. sort-bytes! did not collapse into sort!, and the reason is the point of the predicates: a [u8] is not ordered? and cannot be, because < is an instruction and comparing two slices lexicographically is a loop. It is sort-by! with bytes<? written in, one line, keeping its name and its stability note. sum-i32/sum-f32 and append-i64!/append-f64! stay for the reasons the spike gave. Not what the notes predicted: none of the ten collapses on a signature change alone. filter and reduce need copyable? because the checker demands it - reduce's accumulator at (Vec i32) is a double move - and the rest declare it because a slice of owning elements would have them duplicating headers.
11 lines
503 B
Plaintext
11 lines
503 B
Plaintext
;;;; A generic that instantiates itself at a larger type every time.
|
|
;;;;
|
|
;;;; (grow [x x]) asks for a copy at [t], which asks for one at [[t]],
|
|
;;;; forever. Before the refusal this did not fail, it *hung*, and since
|
|
;;;; Session.eval runs the same code the thing that hung was C-c C-c with the
|
|
;;;; dev daemon wedged behind it. The refusal names the chain of
|
|
;;;; instantiations rather than a depth it gave up at.
|
|
(defn grow [x $t] () {:where (copyable? $t)} (grow [x x]))
|
|
|
|
(defn main [] () (grow 1))
|