laurent.orseau
2021-7-4 10:52:02

Ah, so if I change the printer to pretty print in sandbox/eval, it should work too then I guess


shu--hung
2021-7-4 13:01:42

In Racket, can class be made applicative as in prop:procedure for structs? I am not doing anything. I am trying to understand the differences structs and classes, including how struct properties and various prop:--- hooks fit in the picture.


soegaard2
2021-7-4 13:12:59

Both objects and classes are represented as structs. As far as I know, there is no support for applicative objects currently. However, it would be relatively simple to add.

That objects are represented as structs can be seen here:

https://github.com/racket/racket/blob/master/racket/collects/racket/private/class-internal.rkt#L2443

FWIW - the class macro takes the prize for the largest macro!


soegaard2
2021-7-4 13:13:41

As an alternative to applicative objects, you can define your own version of #%app .


shu--hung
2021-7-4 13:20:29

Thanks! I think the spec of the API for applicative classes is then a question.

Yes, right now I am making the analogy of prop:procedure as being a field of the struct, and #%app as method calls. This gives me some hint about what struct/c cannot specify.


shu--hung
2021-7-4 13:21:02

(For context, I am going through this https://github.com/racket/racket/issues/2574 )


mflatt
2021-7-4 13:38:19

You can attach a structure type property to an interface and then have a class implement the interface.


shu--hung
2021-7-4 13:44:23

I totally missed that! Thanks for the pointer


soegaard2
2021-7-4 13:47:38

Neat.


biz
2021-7-4 15:57:43

@biz has joined the channel


biz
2021-7-4 18:05:46

Hi all, I’ve got a design/knowledge question! I find this pattern to be not uncommon in my code: (for/vector ([lst '((1 2 3) (a b c) (! @ \#))]) (match lst [(list v1 v2 v3) (vector v1 v2 v3)])) ;; would produce '#(#(1 2 3) #(a b c) #(! @ \|#\|)) And I’d love to write a macro of some description to reduce it down to something like this (for/vector ([(list v1 v2 v3) '((1 2 3) (a b c) (! @ \#))]) (vector v1 v2 v3)) Which would expand out to something like this (for/vector ([(v1 v2 v3) (sequence-map (match-lambda [(list v1 v2 v3) (values v1 v2 v3)]) '((1 2 3) (a b c) (! @ \#)))]) (vector v1 v2 v3)) I have ideas on how to implement a macro that would let me do such a thing, but I’m not sure how I’d find all of the identifiers that would be bound in an arbitrary match pattern.

I’d rather not rewrite the entire syntax parser for match just to be sure that I didn’t misinterpret any literals for identifiers. Does anybody have pointers on how to approach a problem like this?


soegaard2
2021-7-4 18:09:42

I am wondering whether you are solving the same problem as in-match is intended to do?

https://docs.racket-lang.org/adjutor/Unstable.html?q=in-match#%28form._%28%28lib._adjutor%2Funstable..rkt%29._in-match%29%29


sorawee
2021-7-4 18:14:15

biz
2021-7-4 18:17:50

These are both very interesting! I think unified-for seems closer to what I was looking for, as I wouldn’t need to provide two sets of identifiers (one for the match, one for the for loop)


soegaard2
2021-7-4 18:19:51

I am attempting to make a Github Action that automatically builds Sketching each time I push a new commit. I think, I need some hints.

The action is : on: - push jobs: test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@master - name: Install Racket uses: Bogdanp/setup-racket@v0.11 with: architecture: 'x64' distribution: 'full' version: '8.1' - name: Install Package and its Dependencies run: raco pkg install --auto --batch sketching/ Here sketching is a dummy package that depends on the packages sketching-lib sketching-doc and sketching-examples. However, I can see that the above raco command asks the package server for sketching-lib etc instead of using the ones in the repo.

Any hints?

Or perhaps there is an example somewhere of using Github action with a repo with multiple packages?



soegaard2
2021-7-4 18:30:28

Thanks for the example!


soegaard2
2021-7-4 19:11:41

I am getting this error: open-output-file: error opening file path: /usr/share/racket/pkgs/.LOCKpkgs.rktd system error: Permission denied; errno=13 Any ideas?

https://github.com/soegaard/sketching/runs/2984781396?check_suite_focus=true


shu--hung
2021-7-4 19:36:59

To work around it for now, install Racket locally in the EDIT: home directory using dest: and sudo: never The issue is that Racket is installed in unix-style so several raco commands need sudo. I think setup-racket does not infer this — may or may not be a bug.


soegaard2
2021-7-4 20:03:02

Thanks @shu—hung . Got over the “Install Racket” hurdle.


soegaard2
2021-7-4 20:03:44

Now I am struggling with a “sketching-lib” not found.


soegaard2
2021-7-4 20:03:59

soegaard2
2021-7-4 20:04:22

I think, it is a package <-> collection issue.


soegaard2
2021-7-4 20:04:44

Currently the package “collection-lib” contains a collection “sketching”.


soegaard2
2021-7-4 20:05:14

So somewhere in one of the info files I have done something incorrectly. I think.


soegaard2
2021-7-4 20:05:44

shu--hung
2021-7-4 20:13:26

sketching-examples isn’t installed, so raco pkg update failed. sketching only pulls sketching-lib and sketching-doc


soegaard2
2021-7-4 20:16:09

Good point! I have now tried just to install/update sketching, but that also leads to an error. run raco setup --check-pkg-deps sketching ... raco setup: 1 making: &lt;pkgs&gt;/sketching-lib/sketching standard-module-name-resolver: collection not found for module path: sketching/lang/reader collection: "sketching/lang" in collection directories: /home/runner/.local/share/racket/8.1/collects ...


soegaard2
2021-7-4 20:16:50

Maybe I need to keep sketching-lib.


shu--hung
2021-7-4 20:20:33

hmm


soegaard2
2021-7-4 20:21:42

Okay raco setup &lt;collection&gt; means shouldn’t setup sketching-lib just sketching. But I still run into the error above.


shu--hung
2021-7-4 20:23:05

Does sketch-dot-methods.rkt work on your computer? I can’t find the reader for #lang sketch


soegaard2
2021-7-4 20:23:30

I’ll try.


shu--hung
2021-7-4 20:23:31

There should be either a lang/reader.rkt in sketching-lib/sketching/ or a reader submodule in sketching/main.rkt


soegaard2
2021-7-4 20:23:46

It should say #lang sketching though.


soegaard2
2021-7-4 20:24:35

Yep - it works here.


shu--hung
2021-7-4 20:24:35

The first step of reading #lang sketching modules is to locate and load its reader, and so the reader submodule or sketching/lang/reader


shu--hung
2021-7-4 20:25:09

Where do you implement the reader?


soegaard2
2021-7-4 20:25:34

Ah! I forgot to commit the reader !


soegaard2
2021-7-4 20:26:59

Thanks for pointing that out - I could looked for that for a long time.


shu--hung
2021-7-4 20:27:23

:slightly_smiling_face:


soegaard2
2021-7-4 20:27:34

I think it worked!