notjack
2019-9-10 15:13:16

Unsure about speed differences, but the single hash approach is certainly much more readable


soegaard2
2019-9-10 15:19:44

+1 for using a hash


jerome.martin.dev
2019-9-10 15:30:36

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


jerome.martin.dev
2019-9-10 15:30:58

I don’t know if that’s the best way to do it, but it works pretty well for my usecase.


chris613
2019-9-10 19:47:24

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


chris613
2019-9-10 19:47:31

any pointers?


chris613
2019-9-10 19:47:41

(define quote/p (or/p (char/p #\') (char/p #\"))) (define str/p (do quote/p (many+/p any-char/p) quote/p))


chris613
2019-9-10 19:48:39

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
2019-9-10 21:06:12

@barcharcraz has joined the channel


samdphillips
2019-9-11 00:34:22

I haven’t messed with MegaParsack in a while but there should be something like (many+/p (not/p quote/p))


samdphillips
2019-9-11 00:39:26

Looking at the API ref maybe char-not/p or char-not-in/p may be more appropriate.


notjack
2019-9-11 01:35:11

a general (not/p <parser>) would probably have issues


notjack
2019-9-11 01:35:50

but a char-not/p or char-not-in/p would work great


samdphillips
2019-9-11 02:08:01

Most likely I was thinking about how I would do it in a regex or parser-tools lexer


philip.mcgrath
2019-9-11 03:55:43

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.