Fix l/r reversal bug, doc! bug, join bug.

This commit is contained in:
Scott Richmond 2023-12-08 18:19:08 -05:00
parent 2681a365f8
commit 37f0350fa3
2 changed files with 8 additions and 8 deletions

View File

@ -331,11 +331,9 @@
docstring (:doc f) docstring (:doc f)
clauses (:clauses f) clauses (:clauses f)
patterns (map first clauses) patterns (map first clauses)
pretty-patterns (map show/show-pattern patterns)] pretty-patterns (map show/show-pattern patterns)
(println name) doc (into [name docstring] pretty-patterns)]
(println docstring) (apply str (interpose "\n" doc)))
(println (apply str (interpose "\n" pretty-patterns)))
:ok)
)}) )})
(def sin {:name "sin" (def sin {:name "sin"

View File

@ -241,7 +241,7 @@ fn panic! {
fn doc! { fn doc! {
"Prints the documentation of a function to the console." "Prints the documentation of a function to the console."
(f as :fn) -> base :doc (f) (f as :fn) -> do f > base :doc > print!
(_) -> :none (_) -> :none
} }
@ -264,8 +264,10 @@ fn join {
([]) -> "" ([]) -> ""
([str as :string]) -> str ([str as :string]) -> str
(strs as :list) -> join (strs, "") (strs as :list) -> join (strs, "")
(strs, separator as :string) -> fold ( ([str, ...strs], separator as :string) -> fold (
fn (joined, to_join) -> concat (joined, separator, to_join) fn (joined, to_join) -> concat (joined, separator, to_join)
strs
str
) )
} }
@ -899,7 +901,7 @@ fn render_turtle! () -> {
add_call! ((:noStroke)) add_call! ((:noStroke))
let #{heading, :position (x, y)} = state let #{heading, :position (x, y)} = state
add_call! ((:translate, x, y)) add_call! ((:translate, x, y))
add_call! ((:rotate, turn/rad (heading))) add_call! ((:rotate, turn/rad (add (heading, 0.25))))
add_call! ((:beginShape)) add_call! ((:beginShape))
let head_unit = heading/vector (heading) let head_unit = heading/vector (heading)
let first = mult (head_unit, turtle_radius) let first = mult (head_unit, turtle_radius)