stefan.kruger
2019-9-25 09:18:31

Is there a way of inspecting the result of a macro expansion, or is that a too simplistic view on my part? I tried the macro stepper thing in DrRacket, but it throws up reams of things I’m not able to follow yet.


samth
2019-9-25 13:37:30

Can you give an example of what you want? The macro stepper is showing the results of expansion


stefan.kruger
2019-9-25 15:05:39

Well, if I have something like (define-syntax (my-macro stx) (syntax-case stx () [(_ name item1 item2) #'(define (name old-state item1 item2 [deficit 0]) (match-let ;; more stuffs here ......)))])) (my-macro fun 'thing1 thing2)


stefan.kruger
2019-9-25 15:06:01

and I wanted to see only what the last line expanded to?


stefan.kruger
2019-9-25 15:12:58

So expanding only “my” stuff — but maybe that’s naive on my part.


stefan.kruger
2019-9-25 15:15:16

It’s clearly not the c pre-processor, right :slightly_smiling_face:


samth
2019-9-25 15:19:44

that should work in the macro stepper; that’s what “macro hiding” is about


chris613
2019-9-25 19:18:05

is there a way to have DrRacket re-open the set of files being edited when closed ?


chris613
2019-9-25 19:18:15

sort of persist session ?


soegaard2
2019-9-25 19:18:54

Yes… I remember that someone write such an extension. But who?


soegaard2
2019-9-25 19:23:34

Can’t find it.


samth
2019-9-25 19:30:11

Here’s what I see with that macro in the macro stepper:


samth
2019-9-25 19:30:27

chris613
2019-9-25 19:46:24

:slightly_smiling_face: no worries thanks for letting me know, ill do some googling :smile:


chris613
2019-9-25 20:01:01

so structs can be transparent ….


chris613
2019-9-25 20:01:31

is there any way to make them transparents only when writing to a file ?


chris613
2019-9-25 20:02:10

(define o (open-output-string)) (write file1 o) (get-output-string o) == "#<describe>" where file1 is a struct “describe”


chris613
2019-9-25 20:03:08

essentially im trying to dump & load a data struct to a file ..


lexi.lambda
2019-9-25 20:04:54

@chris613 You probably want racket/serialize


chris613
2019-9-25 20:05:04

awesome thanks


chris613
2019-9-25 20:05:08

off to do some reading :slightly_smiling_face:


soegaard2
2019-9-25 20:23:35

@stefan.kruger Also look at expand and expand-syntax.