1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 01:28:26 +03:00

bbc-basic: Slight printer tidying.

When printing a vector, don't allocate a string for "(" and then
immediately throw it away.
This commit is contained in:
Ben Harris 2019-05-26 13:38:25 +01:00
parent 30409c3d68
commit d1d0688904

View File

@ -15,8 +15,11 @@ DEF FNpr_str(val%, print_readably%)
IF FNis_symbol(val%) THEN =FNalloc_string(FNunbox_symbol(val%))
IF FNis_corefn(val%) OR FNis_fn(val%) THEN =FNalloc_string("#<function>")
IF FNis_seq(val%) THEN
ret% = FNalloc_string("(") : term$ = ")"
IF FNis_vector(val%) THEN ret% = FNalloc_string("[") : term$ = "]"
IF FNis_vector(val%) THEN
ret% = FNalloc_string("[") : term$ = "]"
ELSE
ret% = FNalloc_string("(") : term$ = ")"
ENDIF
WHILE NOT FNis_empty(val%)
IF FNstring_len(ret%) > 1 THEN PROCstring_append(ret%, " ")
PROCstring_concat(ret%, FNpr_str(FNfirst(val%), print_readably%))