Thanks to Racket I am getting even more understanding of how the interpreter works under the covers, especially
(require racket/trace)
is helping a lot, I can verify my
assumptions with a quick run. This is basically what I wanted to do when I tried to translate the interpreter into Clojure,
but couldn't because of my limited understanding of how to implement a patter match for lambdas.
#!/usr/bin/racket | |
#lang racket | |
;; https://www.cs.indiana.edu/cgi-pub/c311/lib/exe/fetch.php?media=pmatch.scm | |
;; pmatch included here ****************** | |
(define-syntax pmatch | |
(syntax-rules () | |
((_ v c ...) (pmatch-who #f v c ...)))) | |
(define-syntax pmatch-who |
I am going to have a look at what William Byrd presented as The most beautiful program ever written.
Beauty here refers to computer programs, specifically about Lisp. There might be errors as this is something I wrote to make sense of that interpreter, proceed at your own risk.
Thanks a lot to Carl J. Factora for the help.
Real and fake. The more I attend interviews the more I realise how useless they are: sometimes it just feels like you have an hour with your interviewer and you have to fill it somehow with professional questions.
I am really getting lazy with these diary posts recently. Damn.
A few weeks ago I went to this meetup where William Byrd presented an interpreter for Scheme in a few lines. It was a fascinating talk where he spoke about this:
I find that being at a whiteboard completely changes my approach to the problem:
- at the laptop I am like, yeh ok let's code this thing with the first thing that comes into my mind
- at the whiteboard I am all like, uuhhhmmmmm, let's try this approach carefully and see what happens
I've spent most of the day going through this exercise, or better, through this last edge case of this exercise. Basically hackerrank.com runs your code against a set of tests, but it just tells you when you fail a test, without giving either inputs or outputs.
Going through Functional Programming in Scala, exercises and notes are here.
Going through Functional Programming in Scala, exercises and notes are here.