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

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.

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!

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

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.

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

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

I totally missed that! Thanks for the pointer

Neat.

@biz has joined the channel

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?

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


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)

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?

Typed Racket’s workflow has an example of this. The idea is to setup a local catalog referencing the current repository.

Thanks for the example!

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

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.

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

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


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

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

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


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

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: <pkgs>/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
...

Maybe I need to keep sketching-lib.

hmm

Okay raco setup <collection>
means shouldn’t setup sketching-lib
just sketching
. But I still run into the error above.

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

I’ll try.

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

It should say #lang sketching though.

Yep - it works here.

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

Where do you implement the reader?

Ah! I forgot to commit the reader !

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

:slightly_smiling_face:

I think it worked!