cperivol
2021-12-7 16:31:50

I am trying to do something simple but I can’t figure out how. Could someone help me make the following work:

#lang racket (require (for-syntax racket/base)) (begin-for-syntax (define-syntax (macro1 stx) (syntax-case stx () [(macro1 a b) #'(list a b)]))) (define-syntax (macro2 stx) (syntax-case stx () [(macro2 a b) (macro1 #'a #'b)]))


cperivol
2021-12-7 16:32:36

it sais ; ... syntax-case: unbound identifier; ; also, no #%app syntax transformer is bound at phase 2 ; at: syntax-case ; in: (syntax-case stx () ((macro1 a b) (syntax (list a b))))


samth
2021-12-7 16:59:21

Is this what you want? #lang racket (define-syntax (macro1 stx) (syntax-case stx () [(macro1 a b) #'(list a b)])) (define-syntax (macro2 stx) (syntax-case stx () [(macro2 a b) #'(macro1 a b)]))


samth
2021-12-7 17:00:20

It’s possible you want this: #lang racket (require (for-syntax racket/base)) (begin-for-syntax (require (for-syntax racket/base)) (define-syntax (macro1 stx) (syntax-case stx () [(macro1 a b) #'(list a b)]))) (define-syntax (macro2 stx) (syntax-case stx () [(macro2 a b) (macro1 #'a #'b)])) But that doesn’t seem useful.


cperivol
2021-12-7 17:29:04

so the real version of macro1 calls check-equal? so I want it to actually expand in place


soegaard2
2021-12-7 17:30:41

@cperivol I guess the question is: Do you intend to use macro2 on compile time or on runtime?

Btw the #%app is due to the following: The expander will expand an application (f x y) into (#%app f x y). The binding of #%app determines how applications are handled. Normally it is bound to #%plain-app with is the “core application”, but some languages might handle application differently. Now in your program he form #%app wasn’t bound in phase 1 (compile time), so you got an error. The solution as samth shows, is to require it: (require (for-syntax racket/base)) .


cperivol
2021-12-7 17:32:10

Here is macro1 expanded when macro2 is defined or when macro2 is expanded?


samth
2021-12-7 17:32:12

@cperivol I think you want the first thing I wrote


samth
2021-12-7 17:32:38

when macro2 is expanded


cperivol
2021-12-7 17:33:47

Interesting.. Thank you both, this has been illumnating


marc.kaufmannmk
2021-12-7 20:41:30

I am hitting a problem with raco setup, giving me raco setup: directory: #<path:/home/marc/Git/valni/pandaemonium/congame-core/> does not exist for collection: "congame". For context, this is a local library that was installed via raco pkg install congame-core/. For some reason that I don’t understand, when I cloned the repo with the code in a second location on my computer (to try out some stuff), I had to install all the packages again. I thought it was because of an update in Racket, but now I am not sure. Anyway, I raco pkg installed the packages, apparently some path got set to .../pandaemonium/, I then deleted that folder (because my experiment didn’t pan out)… and now I can’t get rid of that setup message. Any clue what’s going on? (Plus, I may be giving you entirely irrelevant details, while missing the important ones.)


sorawee
2021-12-7 20:43:24

Perhaps raco pkg remove congame-core (potentially with --force if regular one doesn’t work)


marc.kaufmannmk
2021-12-7 20:43:37

Another option is to have changing times, allowing different groups, somewhat tilted towards the more popular times of course.


marc.kaufmannmk
2021-12-7 20:44:32

I did that, then reinstalled, and then it complained again. I will try with --force this time.


marc.kaufmannmk
2021-12-7 20:45:55

Maybe related, maybe not, but I also get the following warning from raco setup: raco setup: WARNING: failed to find info for path: /home/marc/.racket/8.2/pkgs/tzinfo/tzinfo/doc/tzinfo/out0.sxref


sorawee
2021-12-7 20:46:20

I don’t think it’s related


marc.kaufmannmk
2021-12-7 20:49:00

Ah, strangely I get the path error only with sudo raco setup, not raco setup (which hits some permission issues instead). I can’t remember if I sudo pkg installed or not - I usually don’t, but sometimes I seem to have to do it (as in, I don’t know what’s going on, but sudo solves it).


sorawee
2021-12-7 20:51:19

sudo raco pkg install is worrying. You should never need to do that


marc.kaufmannmk
2021-12-7 20:56:05

Might have been sudo raco setup something (I believe), but that is probably not any less worrying I presume.


marc.kaufmannmk
2021-12-7 20:59:50

At least on the path error, it seems to be working.


berkozkutuk
2021-12-8 00:55:03

@berkozkutuk has joined the channel


phillip
2021-12-8 06:20:01

Does anyone have an example of how to use place-children in order to layout controls in a custom way? I want to be able to set length/width/top/left like in Java or other GUI tools on a per-control basis.