Unwrapped explode

This commit is contained in:
Devine Lu Linvega 2024-04-07 11:22:18 -07:00
parent 98748fb44d
commit d7f41dca3b
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,3 @@
<> (?x dup) (?x ?x) <> ((explode ?*)) (?*)
<> (?x ?y swap) (?y ?x)
<> ( ?x pop) ()
(1 2 3) (4 5 6) swap pop dup (explode hello)

View File

@ -89,8 +89,12 @@ plode(char *s)
if(!depth) return s; if(!depth) return s;
} }
} else { /* explode */ } else { /* explode */
while((c = *s++) && !spacer(c)) *outp_++ = *s++, *outp_++ = ' ';
while((c = *s++) && !spacer(c)) {
*outp_++ = '(', *outp_++ = c, depth++; *outp_++ = '(', *outp_++ = c, depth++;
if(!spacer(*s))
*outp_++ = ' ';
}
for(i = 0; i < depth; i++) for(i = 0; i < depth; i++)
*outp_++ = ')'; *outp_++ = ')';
} }