Closed echeran closed 7 years ago
Hey, is this referring to the output you get after each movement command? Or is there some other print command I'm missing? I'd like to take this on.
@galbacarys This probably refers to the string representation of the turtle. After each movement command the Turtle record is returned, thus printed in the REPL. There are some functions that determine the format of this string
Yes, @jeisses is right. Keep in mind that there's a difference between println/print (printing meant for humans to read) and prn/pr (printing in such a way that the REPL's reader can read them). The REPL uses prn to print return vals.
A custom prn
has already been implemented / extended for Turtle values for CLJ and for CLJS. So for the purposes here, we just need to work within the pr-str-turtle
fn to customize how the values for :x
, :y
, and :angle
get turned into a string. The math libs in Java vs. JS are probably different, so we'll need reader conditionals.
On second thought, I think just one digit after the decimal point is enough.
When printing the turtle position in the REPL, we get full precision of the floating point. We only need 2 decimal places at most.