Skip to content

very simple keyword support #65

Description

@dragoncoder047

earlier I think I mentioned that I implemented generic keywords by automatically wrapping them in (quote) in the reader, but that's probably a bad solution if I ever implement macros. I just came up with another solution that is super simple and works with macros:

    // in eval ()
    if (symbolp(form)) {
+       if (nthchar(princtostring(form), 0) == ':') return form; // Keyword
        symbol_t name = form->name;
        object* pair = value(name, env);
        if (pair != NULL) return cdr(pair);
        pair = value(name, GlobalEnv);
        if (pair != NULL) return cdr(pair);
        else if (builtinp(name)) return form;
        Context = NIL;
        error(PSTR("undefined"), form);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions