notjack
2020-12-11 09:24:55

it’s when you make a module that imports everything from some other module and reprovides it. This lets you add information to the bindings. You do have to change code to import your wrapper module instead of the original module though.


badkins
2020-12-11 21:54:39

FYI - I discovered a sizable performance penalty (~ 7x) when using curry For example: (define is-empty? (curry char=? empty-loc)) vs. (define (is-empty? seat) (char=? empty-loc seat)) I knew curry created a function, but I didn’t realize the runtime dispatch had such an impact. I probably stumbled upon an extreme example accidentally since the 3 functions are in an inner loop.


badkins
2020-12-11 21:58:27

I guess I should look at the source for curry because (define-syntax-rule (curry1 f a) (λ (b) (f a b))) seems to have practically zero overhead.


jgeddes
2020-12-11 22:00:07

Darn. I’ve been using curry a lot (in Advent of Code) in maps to avoid the line noise of (lambda (seat) (char=? empty-loc) .


sorawee
2020-12-11 22:00:38

Racket BC or CS?


badkins
2020-12-11 22:01:01

I’m on BC 7.5


jaz
2020-12-11 22:33:47

@badkins You might want to use Sam’s fancy-app for that instead


samdphillips
2020-12-11 22:33:59

@badkins (check for contracts…)


badkins
2020-12-11 22:34:16

no contracts! - said in the voice of Edna Mode


jaz
2020-12-11 22:35:03

On this test: #lang racket/base (require fancy-app (only-in racket/function curry) data/enumerate data/enumerate/lib) (define empty-loc #\L) (define is-empty1? (curry char=? empty-loc)) (define is-empty2? (char=? empty-loc _)) (define (is-empty3? c) (char=? empty-loc c)) (define (gc!) (collect-garbage) (collect-garbage) (collect-garbage)) (define chars (for/list ([i (in-range 1000000)]) (from-nat char/e i))) (gc!) (displayln "w/ curry") (time (for ([c (in-list chars)]) (is-empty1? c))) (gc!) (displayln "w/ fancy-app") (time (for ([c (in-list chars)]) (is-empty2? c))) (gc!) (displayln "plain") (time (for ([c (in-list chars)]) (is-empty3? c))) I get the following: w/ curry cpu time: 95 real time: 95 gc time: 1 w/ fancy-app cpu time: 8 real time: 9 gc time: 0 plain cpu time: 7 real time: 8 gc time: 0


jaz
2020-12-11 22:37:35

That’s on 7.9 BC. On CS (I don’t have 7.9 CS, but I imagine the numbers for other recent versions are representative anyway), the curry version is considerably faster than under BC but still much slower than the others.


badkins
2020-12-11 22:38:08

Cool - thx!


samdphillips
2020-12-11 22:38:09

Does anyone have a good way of building a Racket app in Docker without pulling in a ton of extra stuff?


samdphillips
2020-12-11 22:40:11

I think a combination of manual installation of dependencies and —force may work…


notjack
2020-12-11 22:40:19

ah like, making an app that has only the result of raco distribute instead of the whole compiler toolchain?


samdphillips
2020-12-11 22:41:04

Yeah. I guess I could do a raco distribute build and then do a multistage doohickey.


samdphillips
2020-12-11 22:41:46

One thing brings in racket-doc and then everything gets explodey


popa.bogdanp
2020-12-11 23:00:09

That’s what I tend to do:

https://github.com/MarcKaufmann/congame/blob/90bc0402729626ea7e32eb5b1d36769f7b28f76f/Dockerfile

(raco koyo dist is just raco exe + raco distribute)


samdphillips
2020-12-11 23:11:09

Yep. I just ended up trying that and it looks much better.


sorawee
2020-12-11 23:25:07

sorawee
2020-12-11 23:27:17

Edna would have said: “No no contracts!”


yilin.wei10
2020-12-12 01:54:08

@sorawee I noticed that you had some PR’s in lispyville; might I ask whether you’re all in on lispy, or just using the lispyville hooks?


sorawee
2020-12-12 02:00:35

Honestly, I forget already what lispy & lispyville do lolol. I also think I use them incorrectly and very inefficiently (mostly for paren balancing and comment edit)


sorawee
2020-12-12 02:00:58

sorawee
2020-12-12 02:01:56

I do use lispyville-like movement a lot, but the one provided by lispyville is buggy, so I create my own.



kellysmith12.21
2020-12-12 03:00:44

It didn’t occur to me that it’d be a bit tricky to generate immutable bindings when using match patterns for all binding forms…


samth
2020-12-12 03:08:53

sorry about that spam


kellysmith12.21
2020-12-12 05:59:44

Today I learned that primitive forms (e.g. module, begin-for-syntax, &c.) do not count as being bound to syntax.


sorawee
2020-12-12 06:01:01

What do you mean by that?


kellysmith12.21
2020-12-12 06:42:15

The result of (syntax-local-value #'module) is an error that says that module is not bound to syntax.