Hacker News new | ask | show | jobs
by dingleberry 1470 days ago
is it possible to break the grammar? that the first element must be a form

example (A' 2 3) to access row 2 and col 3 of a transposed matrix A

1 comments

Short answer: Yes, but it's preferred to do something a little easier.

In Common Lisp, it's much easier if you prefix. It would totally be possible to do something like

    [A x y]
to be an array accessor at indexes x and y by defining reader macros for the characters '[' and ']'. And then one could define the reader macro for the character 'ᵀ' so that

    ᵀA
expands to the transpose of A. Then you could write

    [ᵀA x y].
If you didn't like this prefix thing, you could instead be more elaborate with '[' and parse something more complicated with postfix notation.