carp-lang / Carp

A statically typed lisp, without a GC, for real-time applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FR: Better REPL output

glyh opened this issue · comments

Here are some of the weird output in REPL:

> {1 1.0 2 2.0}
=> (() () () () () () () () () () () () () ((1 1.0)) ((2 2.0)) ()) ;; Expect: {1 1.0 2 2.0}
> (and true true true)
=> (if true (if true true false) false) ;; Expect: true

Hi, thanks for reporting. I agree these are quite strange and confusing 😅 Will fix! (eventually)

The map is an unfortunate side effect of the internal implementation bleeding out. We had an idea to implement a dynamic types and a protocol dispatcher (see #1177) but the implementation was deemed a little too magical (totally fair). I mention this because that would have meant that dynamic maps could have an implementation for str, which currently is not possible (it just prints lists, as shown above).

The other issue is the long-standing macro expansion versus evaluation in the REPL. I thought we had an approach to make it work at some point, but I guess it was never implemented :( My bad!