orangeduck/BuildYourOwnLisp

In chapter 9, some code may be unneeded

Closed this issue · 1 comments

I am following the book(great resource!), and in chapter 9, in function lval_read, I think the lines
if (strcmp(t->children[i]->contents, "}") == 0) { continue; }
if (strcmp(t->children[i]->contents, "{") == 0) { continue; }

are from the following chapter on q-expr. Till now "{" or "}" are not in the language defined by the parser.

Also, I am not sure about the "regex" in the following line, as it also isn't defined. I assume these lines will never be executed, so don't really cause a problem, but are somewhat confusing.

In the git repo, these lines will be from https://github.com/orangeduck/BuildYourOwnLisp/blob/master/chapter9_s_expressions.html#L270

Same change on the source code at https://github.com/orangeduck/BuildYourOwnLisp/blob/master/src/s_expressions.c#L261
as well.
I think a patch would be just removing these lines? I can submit a pull request, if this seems correct.

Yeah good find I think removing those lines makes sense 👍