
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)]))

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))))

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)]))

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.

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

@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))
.

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

@cperivol I think you want the first thing I wrote

when macro2 is expanded

Interesting.. Thank you both, this has been illumnating

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 install
ed 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.)

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

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

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

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

I don’t think it’s related

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 install
ed 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).

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

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

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

@berkozkutuk has joined the channel

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.

I implemented a grid control where I used it: https://github.com/alex-hhh/ActivityLog2/blob/master/rkt/widgets/grid-pane.rkt\|https://github.com/alex-hhh/ActivityLog2/blob/master/rkt/widgets/grid-pane.rkt