ref: edd468e09a359a3e056e9ad727b0f6dcff122b0e
parent: 53a11dd7268c0d550a332e1ba939813d378cd24e
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Apr 8 22:58:10 EDT 2025
constructor notation: allow [] and {} in addition to ()
--- a/src/read.c
+++ b/src/read.c
@@ -710,12 +710,12 @@
// constructor notation
c = nextchar(ctx);
ctx->loc = RS->loc;
- if(c != '('){
+ if(c != '(' && c != '[' && c != '{'){
take(ctx);
parse_error(&ctx->loc, "expected argument list for %s", sym_name(ctx->tokval));
}
PUSH(sl_nil);
- read_list(ctx, UNBOUND, TOK_CLOSE);
+ read_list(ctx, UNBOUND, c == '(' ? TOK_CLOSE : (c == '[' ? TOK_CLOSEB : TOK_CLOSEC));
if(sym == sl_vu8sym){
sym = sl_arrsym;
sl.sp[-1] = mk_cons(sl_u8sym, sl.sp[-1]);