callimachus
2021-4-21 07:40:25

@callimachus has joined the channel


ananth.pattabiraman
2021-4-21 15:35:33

@ananth.pattabiraman has joined the channel


a.nastaev
2021-4-21 18:30:26

A quick question here: How can I inspect or log things in Racket? Is there a way to do that?


a.nastaev
2021-4-21 18:30:33

Thanks a lot in advance!


soegaard2
2021-4-21 18:32:57

Actual logging can be done as described here: https://docs.racket-lang.org/reference/logging.html?q=logger

But if you just want to see some value, then I usually just use displayln .


soegaard2
2021-4-21 18:35:52

Also, there is a traditional debugger available (but for some reason, I never use it): https://docs.racket-lang.org/drracket/debugger.html?q=debugger


a.nastaev
2021-4-21 18:36:42

@soegaard2 Thank you! I mean if I have this piece of code: (define (sup l) (cond [(empty? (rest l)) (first l)] [else (if (> (first l) (sup (rest l))) (first l) (sup (rest l)))])) How can I inspect (I’m coming from Elixir where we use a lot of IO.inspect() ) what is going on in different clauses? Thanks a lot again!


soegaard2
2021-4-21 18:37:19

I like the simple solution:


soegaard2
2021-4-21 18:38:55

(define (sup l) (cond [(empty? (rest l)) (displayln (list "rest is empty: " l)) (first l)] [else (displayln (list "rest not empty: " l)) (if (> (first l) (sup (rest l))) (first l) (sup (rest l)))])) But … this type of program is perfect for (hold your horses) The Algebraic Stepper.


soegaard2
2021-4-21 18:39:29

The algebraic stepper allows you to run your program one step at a time (and go backwards).


soegaard2
2021-4-21 18:40:33

soegaard2
2021-4-21 18:41:53

In your case, enter the function definition and a call to it, like: (define (sup l) (cond [(empty? (rest l)) (first l)] [else (if (> (first l) (sup (rest l))) (first l) (sup (rest l)))])) (sup (list 1 2 3 4 5)) Choose “Intermediate Language with lambda” and then click the foot.


a.nastaev
2021-4-21 18:42:40

@soegaard2 thank you so much! That is exactly what I wanted :slightly_smiling_face: Thanks a lot again!


joel
2021-4-21 18:57:57

In creating a #lang my-lang how would I go about expanding this: #lang my-lang x y (+ 1 2) into this: (define (func x y) (list x y 3))


sorawee
2021-4-21 19:00:12

Would

(define (func x y) (list x y (+ 1 2))) be OK?


joel
2021-4-21 19:01:02

I think what I’m asking is how to expand each expression when it might refer to arguments of a function it doesn’t know about yet


thybault.alabarbe
2021-4-21 19:01:46

I think you’re supposed to quote the arguments and unquote them in the macro, but I could be wrong


samth
2021-4-21 19:01:53

The easiest would be (define-syntax-rule (#%module-begin vars:id ... body) (define (func vars ...) (list vars ... body)))


samth
2021-4-21 19:02:09

sorry that should be define-syntax-parse-rule


joel
2021-4-21 19:05:34

OK yes, that would give me (define (func x y) (list x y (+ 1 2)))


joel
2021-4-21 19:08:23

But what I really need to be able to do (I think, in this project) is expand-once each expression before it goes in the function.


joel
2021-4-21 19:09:22

Because #lang my-lang module might include forms that expand to require or define


joel
2021-4-21 19:10:07

(Some of you probably recognize this is related to my beeswax thing https://github.com/otherjoel/beeswax)


sorawee
2021-4-21 19:10:46

You can use local-expand with define-values and #%require in the stop list to recognize those forms that expand to require and define.


joel
2021-4-21 19:13:38

OK, I will read up on that one, thanks! :+1:


phoe
2021-4-21 19:39:11

@phoe has joined the channel


chansey97
2021-4-21 19:55:04

Is there a convenience way to comment out enclosing expressions? For example: (define testo (λ (x) (onceo (conde ((== 'tea x) succeed) ((== 'cup x) succeed) (else fail))))) I’d like to comment onceo . (define testo (λ (x) ;; (onceo (conde ((== 'tea x) succeed) ((== 'cup x) succeed) (else fail)) ;; ) )) “paredit” can raise a sexp though, not comment.


sorawee
2021-4-21 19:58:00

thechairman
2021-4-22 00:52:45

I think you could get what you want with block comments #\| ... \|# :

for example, this would just leave (== 'tea x) as the definition of the lambda function #lang racket (define testo (λ (x) #\| (onceo (conde ( \|# (== 'tea x) #\| succeed) ((== 'cup x) succeed) (else fail)) \|# ))


jbclements
2021-4-22 05:57:36

As many of you now know, we’re well into the release cycle for version 8.1 of Racket.

Racket, of course, isn’t just a language implementation. It’s a community of implementors (that’s you!), and all of the amazing packages that you produce.

As part of the release process, we run tests on every released package, using the current release candidate.

As is usually the case, some packages that worked in the last version (8.0) are not working correctly with the release candidate.

This is sometimes because of a regression in the package, and sometimes because of a new problem with Racket itself.

We currently have a tracking issue on github, showing all of the package regressions:

https://github.com/racket/racket/issues/3779

If any of these packages are yours, you might be interested to see what’s going on, and maybe there are things you can fix! Exciting!

You should keep in mind that this is only a list of those packages that have observably regressed since last time. There are of course many other packages with build or test failures, and you can always see these listed at

https://pkg-build.racket-lang.org

Thanks in advance for your help!

John Clements & the Release Management Team