Unsure about speed differences, but the single hash approach is certainly much more readable
+1 for using a hash
For what it’s worth, on my own emulator system I chose to have a list of lists exactly equivalent to the real CPU instruction table, so that fetching an instruction is O(n). https://github.com/euhmeuh/virtual-mpu/blob/master/mpus/6802.tab
I don’t know if that’s the best way to do it, but it works pretty well for my usecase.
im messing about with parsers. using megaparsec. and maybe im missing something but i can figure out how to consume chars while they do not match a parser
any pointers?
(define quote/p (or/p (char/p #\') (char/p #\")))
(define str/p
(do quote/p
(many+/p any-char/p)
quote/p))
so the (many+/p any-char/p) will just keep consuming, but i want it to only consume while the char does not satisfy quote/p
@barcharcraz has joined the channel
I haven’t messed with MegaParsack in a while but there should be something like (many+/p (not/p quote/p))
Looking at the API ref maybe char-not/p
or char-not-in/p
may be more appropriate.
a general (not/p <parser>)
would probably have issues
but a char-not/p
or char-not-in/p
would work great
Most likely I was thinking about how I would do it in a regex or parser-tools lexer
Just catching up on Slack. You might want to look at web-server/lang/serial-lambda
: https://docs.racket-lang.org/web-server-internal/closure.html Despite the name, it doesn’t have anything inherently to do with web programming: serial-lambda
is like lambda
, but creates a serializable struct that is also a procedure?
. Internally it uses the module-path + identifier approach, essentially, but racket/serialize
gets to deal with all the tricky module path issues for you.