@mccoybecker has joined the channel
I’m having some issues with my scribblings
setup in a package I’m working on. Specifically, scribblings/microKanren.scrbl:2:20: collection not found
for module path: microKanren
collection: "microKanren"
in collection directories:
/home/mccoy/.local/share/racket/8.2/collects
/home/mccoy/racket/collects/
... [176 additional linked and package directories]
location...:
scribblings/microKanren.scrbl:2:20
context...:
/home/mccoy/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt:383:27
/home/mccoy/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt:385:0: call-with-summary
when I run raco test .
— despite the fact that my info.rkt
registers the package name: #lang info
(define collection "microKanren")
(define deps '("base"))
(define build-deps '("scribble-lib" "racket-doc" "rackunit-lib"))
(define scribblings '(("scribblings/microKanren.scrbl" ())))
(define pkg-desc "A Racket implementation of microKanren.")
(define version "0.0.1")
(define pkg-authors '(femtomc))
can anyone easily see what’s up here?
Re — even if I make a blank project blarg
, it seems like things are not quite setup correctly. ~/Dev/blarg
❯ raco test . Dev/blarg
raco test: "./info.rkt"
raco test: (submod "./main.rkt" test)
scribblings/blarg.scrbl:2:20: collection not found
for module path: blarg
collection: "blarg"
in collection directories:
/home/mccoy/.local/share/racket/8.2/collects
/home/mccoy/racket/collects/
... [176 additional linked and package directories]
location...:
scribblings/blarg.scrbl:2:20
context...:
/home/mccoy/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt:383:27
/home/mccoy/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt:385:0: call-with-summary
.../private/map.rkt:40:19: loop
/home/mccoy/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt:385:0: call-with-summary
.../private/map.rkt:40:19: loop
[repeats 7 more times]
/home/mccoy/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt:385:0: call-with-summary
.../private/map.rkt:40:19: loop
/home/mccoy/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt:1113:1: test
body of "/home/mccoy/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt"
/home/mccoy/racket/collects/raco/raco.rkt:41:0
body of "/home/mccoy/racket/collects/raco/raco.rkt"
body of "/home/mccoy/racket/collects/raco/main.rkt"
Have you installed it? — raco pkg install
No! did not think you needed to do this to test it locally
I’m encountering surprising behavior when attempting to display the results of syntax->list
. For example, the following seems to spin forever (once I add the syntax->list
related code): #lang racket/base
(require (for-syntax racket/base))
(define-syntax (my-mac stx)
(syntax-case stx ()
[(_ a b)
(with-syntax ([ line (syntax-line stx) ]
[ col (syntax-column stx) ]
[ pos (syntax-position stx) ]
[ src (syntax-source stx) ]
[ lst (syntax->list stx) ])
#'(begin
(printf "Source ~a\n" src)
(printf "Line ~a. Column ~a. Position ~a\n" line col pos)
(printf "List ~a\n" lst)))]))
(my-mac 4 5)
However, when I type the following directly into the REPL (DrRacket), it works fine: (printf "List ~a\n" (syntax->list #`(my-mac 4 5)))
Thoughts?
Try: #lang racket/base
(require (for-syntax racket/base))
(define-syntax (my-mac stx)
(syntax-case stx ()
[(_ a b)
(with-syntax ([ line (syntax-line stx) ]
[ col (syntax-column stx) ]
[ pos (syntax-position stx) ]
[ src (syntax-source stx) ]
[ lst (syntax->list stx) ])
(begin
(printf "Source ~a\n" src)
(printf "Line ~a. Column ~a. Position ~a\n" line col pos)
(printf "List ~a\n" lst)
#'42))]))
instead.
The problem is that #'(begin (printf "List ~a\n" lst))
expands to (begin (printf "List ~a\n" (my-mac 4 5)))
which invokes the same macro again.
…and trying the macro stepper seems to have killed DrRacket
Alternatively: Use 'lst
not lst
.
That is: #lang racket/base
(require (for-syntax racket/base))
(define-syntax (my-mac stx)
(syntax-case stx ()
[(_ a b)
(with-syntax ([ line (syntax-line stx) ]
[ col (syntax-column stx) ]
[ pos (syntax-position stx) ]
[ src (syntax-source stx) ]
[ lst (syntax->list stx) ])
#'(begin
(printf "Source ~a\n" src)
(printf "Line ~a. Column ~a. Position ~a\n" line col pos)
(printf "List ~a\n" 'lst)))]))
(my-mac 4 5)
Hmm…. thanks
I think, there is a setting in the macro stepper for the maximum number of steps to examine.
I wish there was a setting to just macro expand a particular expression and leave the rest of the file appearing unexpanded
Like a breakpoint in a debugger?
I was thinking more like being able to just click on an expression in the macro stepper, making it the “selected” expression, and then the Step button should just show you the next macro expansion step that occurs within that expression and it should pretend that no changes to any other expressions happened
The macro stepper supports macro hiding, though it only works with module-level macro invocation IIRC
yeah I don’t think this would be technically hard, it’s just a UI improvement I really want
Oh, I just tried it and it seems to work with non module-level macro invocation too. Maybe I remembered it wrong
It is a good idea. You should log an issue describing it. So it isn’t forgotten
@sorawee, this is the minimal example of the potential bug - https://github.com/hackberrydev/demod-test. I included the list of commands in the README. I’m still not sure if I’m doing something wrong or if it’s indeed a bug. What do you think? Thanks.
It is a bug, I think. @mflatt would be able to confirm.
The problem seems to be due to gregor
. require
-ing other libs doesn’t seem to cause the problem.
Interesting. Thanks. I’ll file a bug. Just wanted to be sure I’m not doing anything obviously wrong.