Weekly Links


'Build Your Own Lisp' Solutions: 6.5

Q: › Change the grammar to recognise operators written in textual format 'add', 'sub', 'mul', 'div'.


A:

"                                                   \
number   : /-?[0-9]+/ ;                             \
operator : 'add' | 'sub' | 'mul' | 'div';           \
expr     : <number> | '(' <operator> <expr>+ ')' ;  \
lispy    : /^/ <operator> <expr>+ /$/ ;             \
"



Weekly Links - The Glorious Future Of Technology Edition


'Build Your Own Lisp' Solutions: 6.4

Q: Change the grammar to add a new operator such as '%'.


A:

"                                                   \
number   : /-?[0-9]+/ ;                             \
operator : '+' | '-' | '*' | '/' | '%';             \
expr     : <number> | '(' <operator> <expr>+ ')' ;  \
lispy    : /^/ <operator> <expr>+ /$/ ;             \
"



Weekly Links - Video Edition

I try not to post too many videos in weekly links, which means I now have a huge backlog of videos. Enjoy.




Weekly Links - Feeling Happy Because Life Is Good Edition


'Build Your Own Lisp' Solutions: 6.3

Q: Write a regular expression matching pit, pot and respite but not peat, spit, or part.


A:

# This works, but is a weird answer to a weird exercise.
/(^|res)p[io]/



Weekly Links - Politics Edition


Weekly Links - 50% NSFW Edition