bakpakin (https://gitter.im/janet-language/help?at=5fcc1cf375f7397e29f66fcc)
There are several functions for printing out "readable" versions of values, so I'll try to explain some of this:
-
string
,symbol
,buffer
,keyword
- constructors for these byte sequences. Other byte sequences will get spliced in, things like numbers and tables will get converted as withdescribe
. -
describe
- Get a human readable but non-recursive description of a value as a string. This means the identity of an object should be more or less determinable from the output (i.e. if they print the same, they are probably=
). For things like tables, tuples, structs and arrays, this means printing the pointer since these are recursive types. -
pp
- not really relevant actually, since the output of this is configurable. -
(printf "%j" value)
- Prints jdn, which is what people think of when they think of lisp pretty printing. Prints values much like they would appear in source code (for a subset of values). Values printed in this manner can be read back as Janet source code to recover a value that isdeep=
to the original. -
(printf "%M" value)
- There are other formatters, like%M
,%N
,%p
,%q
, etc. for printing out all values in a way that looks nice. However, the output will not be readable by Janet's reader and may hide information.
All of the formatting arguments apply to functions like string/format
, buffer/format
, and errorf
as well.
Older notes
janet_buffer_format based
-
printf - (io.c) wrapper around cfun_io_printf_impl_x which may use janet_buffer_format
-
pp - (boot.janet) wrapper around printf
-
string/format - (string.c) uses janet_buffer_format from pp.c
otherwise(?)
-
print - (io.c) wrapper around cfun_io_print_impl_x which may use janet_to_string_b
-
describe - (corelib.c) uses janet_description_b from pp.c which may use janet_to_string_b