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)
clauses (:clauses f)
patterns (map first clauses)
pretty-patterns (map show/show-pattern patterns)]
(println name)
(println docstring)
(println (apply str (interpose "\n" pretty-patterns)))
:ok)
pretty-patterns (map show/show-pattern patterns)
doc (into [name docstring] pretty-patterns)]
(apply str (interpose "\n" doc)))
)})
(def sin {:name "sin"

View File

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