
Try running out from the command line to see if there’s any error message

Hi, I’d like to use Herbie for some statistical calculations@pavpanchekha The documentation shows how to use it through the browser or the CLI, but is there a way to use it as a lib to automatically process Racket code? Perhaps through a macro?

Racketeers on Linux: I’d like to update this wiki page about setting the Path on different platforms to include Linux distributions! Can you add instructions with the assumption that the new racketeer has downloaded your distro for the first time. Don’t think ‘barely anyone uses my distro’, there is no need. You chose it for a reason and someone else will too. https://github.com/racket/racket/wiki/Set-your-PATH-environment-variable (yes I know I need to rename this page) Preferred format: Distro name, relevant details (i.e. which shell), and steps to set the $PATH so raco
command line tools are usable.

Are you using the teaching languages? If so, it could be the same thing as https://github.com/racket/racket/issues/3688 . (If not, then it’s something else.)

@spdegabrielle The Racket ~group~ subreddit normally looks like this with my settings:

But I accidentally clicked to see how the “new” reddit looks like:

This is Chrome on macOS.

On purpose?

Looks like this to me

safari

@soegaard2 I used your image - my apologies I should have asked permission.

Is it ok to keep using it.

if the concern is about the clipping the line of racket logos. It wasn’t intentional but I liked it so I left it.

maybe it needs a refresh

banner requirements:

Submissions welcome!

I tried medium

@spdegabrielle No no - You asked to use the image - and that’s fine. I was just surprised that the layout had changed.

In my screen shot it’s difficult to see that it is in fact the Racket logo.

try refresh now I’ve changed it to medium.

or submit an image 4000x64 as a replacement?

I’ll put that on the todo list :slightly_smiling_face: It’s a little pixelated here.

Will a svg work?

let me check

gives an error when I try a svg file I have. (I tried a private test reddit I have)

Ok. png it is.

Maybe sneak a subtle standard-fish in? :rolling_on_the_floor_laughing:

@adrian.stratulat91 has joined the channel

In Scribble, how do I include the actual current value of a parameter as the value for #:value
in defparam
?

Does #:value (name)
work? (where name
is the name of the parameter?

You will need, to require the module exporting the parameter at compile time though.

Nope, that just puts (name)
into the typeset result, verbatim. (Which is technically correct but not very helpful :laughing:)

That was unexpected :astonished:

Ah! The docs for defproc
says: > #:value value-expr-datum

Does #,(name)
work?

Well no, I’m getting an unbound identifier error, which probably indicates an unrelated problem. I am doing (require (for-label package-that-provides-name))
so I’m a bit mystified though. I also tried adding a (require (for-syntax ... ))

Using #,(name)
would refer to name
as a regular run-time (of the document) binding.

Ah! which means I need to just (require package)
in addition to the for-label
thing. That fixed it!

I’m still scratching my head about #,
though. Is that in the docs somewhere?

I didn’t see it in the docs, either, so something there needs to improve. But unsyntax
is used as an escape with a lot of racketblock
-derived things, so it was a guess.

Hello! I attempted to compile racket into webassembly (more specifically “bc scheme” / “racketcgc”) using emscripten and after a couple of changes in code[1][2] it generated a “binary”. Now it’s displaying a Welcome to Racket v8.0 [cgc]
banner and crashing inside the initialization code. It’s crashing with exception thrown: longjmp; Uncaught longjmp
errors inside the browser’s javascript console.
I understand it’s not a supported use-case and it’s a long shot anyway, but maybe someone more familiar with the racket sources sees something useful. I admit I’m not familiar with racket’s internals, and I just made changes and checked if they stuck.
Anyway, the crashing implementation is hosted at [3], and my development branch and build instructions are at [4][5].
Thanks!
[1] https://github.com/adrians/racket/commit/8aa24a511475997c6dbedf98c01dd31c25166e78 [2] https://github.com/adrians/racket/commit/5c07793b72f37382740fe64d5a081ac8250e9582 [3] https://low-level.wiki/diverse/racket-emscripten/racketcgc.html [4] https://github.com/adrians/racket/tree/v8.0-emscripten [5] https://low-level.wiki/diverse/racket-emscripten.html

@adrian.stratulat91 Have you tried disabling the JIT?

Yes, it’s configured with ../configure --enable-bconly --disable-jit --disable-docs --disable-gracket --disable-pthread --disable-futures --disable-places --enable-cgcdefault --disable-foreign --disable-libffi

FWIW I notice http://emscripten.org\|emscripten.org has the following to say about longjmp.

Maybe @mflatt or @samth knows whether there is chance for this work?

I assumed the code is not attempting to do anything crazy with the stack. Anyway, another issue was that the ffi parts from “bc” were not truly disabled even after passing the "—disable-foreign" parameter, so I had to manually modify the makefiles.

Maybe. I am not 100% sure :slightly_smiling_face:
When the stack is full, Racket copies it to the heap and resets it. This way you never get a stackoverflow.

Apropos, the top link on http://racket-stories.com\|racket-stories.com is currently: https://stackoverflow.com/questions/49912204/why-there-is-no-such-thing-as-stack-overflow-in-racket

Ooh, interesting!

@sschwarzer has joined the channel

I have a question about naming.
Currently I have two identifiers in the same module which conflict. One is the accessor group-tasks
for the field tasks
in the group
struct. The other identifier is a procedure to group tasks. (I already have a procedure sort-tasks
.) What do you suggest to resolve the name conflict?
Should I rename sort-tasks
to sort/tasks
and call the grouping procedure group/tasks
? Would this be idiomatic?

And by the way, hello everyone. :slightly_smiling_face:

Hi, @notjack usually has great input for that kind of question.

I like your suggestion though - in order not to mess with the names generated by struct.

@soegaard2 Thank you!
Yes, I think manipulating the auto-generated identifiers would be awkward and not worth the trouble (even if it may be possible somehow).

By the way, I’m relatively new to Racket. It’s also my first Lisp. It’s very interesting. :slightly_smiling_face:

Great to have you onboard!

@soegaard2 :slightly_smiling_face:

I’m a bit frustrated that the startup time is a bit long (about 150 ms with racket/base
when compiled with raco exe
), but it’s still kind of ok.

But I have the impression it got slightly better with Racket 8.0. I’m curious how this will develop.

If I recall correctly, Flatt has been working on improving that lately. I don’t know any specifics though.

Good to know this is on the radar. :slightly_smiling_face:

It would be really nice to compile directly to native binaries, but I guess that’s not high on the priority list and I can imagine it’s quite difficult to do.

How about group-tasks-by for the procedure? If it’s fitting of course

However, the startup time becomes rather long as soon as I (require racket/match)
. This about doubles the startup time. So at the moment I use plain cond
.

It surprises me that racket/match alone doubles the time. Without the startup cost, it is just as fast as cond.

Let me check again. …

#lang racket/base
(require racket/match)
"Hello world"

gives me “real” 240 ms and without the require
110 or 140 ms (no idea why the difference)

both programs processed with raco exe

This is with Racket 8.0 on Fedora Linux 33.

I guess racket/match
requires lots of other stuff to match against.

I experimented something similar with Racket 8.0 and Windows 10. I was using the Vulkan API integration. With Racket 8.0 the execution starts after 5 or 6 seconds while in Racket 7.9 was 2 or 3.

Thanks for checking.

@hectometrocuadrado Also translated with raco exe
or executed with racket
?

Executed with DrRacket

There’s really no difference between using raco exe
vs raco make
+ racket

But yes, it looks like Racket CS seems to have a slower startup time in general

@sorawee I meant executing the rkt
file directly with racket
, as in racket my_file.rkt
.

But again, my measurements above are with raco exe test_with_match.rkt
and then time ./test_with_match
.

Right. I meant, raco make test_with_match.rkt; racket test_with_match.rkt
will give you the same performance as raco exe test_with_match.rkt; ./test_with_match

@hectometrocuadrado Note that benchmarking within DrRacket is a bit tricky - since it adds debugging code to your program unless you disable it.

I see. Anyway, that’s not a problem at all.

I really dont know anything about how is Racket made.

I remember being surprised when I learned that DrRacket rewrote the code to add debugging. It’s the same method it uses when you enable code coverage (which is a pretty cool way to see, if your test suite covers all the code).

The principle is described here, but the real implementation is more involved. https://blog.racket-lang.org/2012/12/simple-test-coverage-a-macro-with-line-numbers-and-lifting.html

@soegaard2 I guess the idea is that if you use DrRacket you’re developing your code, so you might need the debugging info.

Yes.

@soegaard2 I’ll take a look. But surely I don’t going to understand anything :D

I don’t even know what code coverage is. XD

Speaking of debugging. Somehow I couldn’t get the debugger to work for executing my “main” file, but setting a breakpoint in another (module) file that’s used by my main file. I’m not sure if I’m using the debugging mode as intended. (I’ve used other debuggers before without such problems.)

@hectometrocuadrado Finding out which lines/expressions are actually executed when running the program.

Here is an example. In the language menu, I have enabled code coverarage. After clicking run, I see:

@sschwarzer Thanks. I have a lot to learn yet.

The parts colored black haven’t been tested.

I also looked for a way to use/find a command line debugger, but didn’t find anything. There’s a “debug-repl” package, but as far as I understand, it only allows inspection, but not stepping over/into expressions.

The odd colors might be due to “dark mode” which is newish.

Oh, that looks cool

@hectometrocuadrado But note that 100 % code coverage during automated testing doesn’t mean that all your code has been tested. In a way, yes, but not all execution paths/combinations. It’s a misunderstanding that often comes up.

@sschwarzer I’ll keep it in mind

Speaking of testing, I tried to find out conventions to structure automated tests with respect to the code under test. Unfortunately, I found lots of conventions and am quite confused now. ;-/ At the moment, I’m using (module+ test ...)
in the module under test, but it may be nice to separate the tests from the tested code.

Using (module+ test ...)
is ok-ish since I can open the same file (for the “actual” code and the tests) in different editor windows. So it’s at least workable.

And I wonder if it’s a good idea if I use test suites because I have to run them explicitly with (run-test ...)
and then the raco test
output contains lots of 0
s (number of failed tests), which I currently filter out with \| grep -v '^0$'
:wink:

Maybe I should put all the test cases in the test module directly and structure them informally with empty lines and comments.

FYI code coverage tool: https://pkgs.racket-lang.org/package/cover\|https://pkgs.racket-lang.org/package/cover I can’t endorse it as I haven’t used it.

Thank you. I saw your reply only now, sorry.

I think both approaches are used. There are pros and cons for both approaches.

Is there something like Python’s getattr
function in Racket? I want something like (struct my-struct
(field1 field2 field3)
#:transparent)
(define my-struct-instance (my-struct 1 "a" 2.0))
(get-field my-struct-instance 'field2) ; -> "a"

I searched for that, but didn’t find anything.

Context: The user effectively selects the field via a command line option.

At the moment, I use an explicitly written hash to map a symbol for the field to the respective accessor function generated by struct
.

No, the field names are not there at run time

You could write a macro to construct your hash table more automatically but that’s the best that’s available at the moment

Hm, makes sense (no runtime field names).

As long as I don’t need this too often, it probably isn’t worth the trouble to define the macro.

Probably the macro would be the most complicated part of the code. :wink:


Actually I think I misread what you were trying to do

But maybe hash-views are what you want: https://docs.racket-lang.org/hash-view/index.html

I <https://pkgd.racket-lang.org/pkgn/package/wavenet|added a package> to the package server earlier today and the build failed with git: could not find requested reference
reference: master
…even though I specified to use branch “main”. What did I miss?

I’ll look into it, thank you.

By the way, I just ran into another situation where I’d need the field access by name/symbol. :laughing:

I think part of the problem of that “task” and “group” are very vague single-word names. What are they for? If “task” was called something like “foo-task” then you could have “group-foo-tasks” and “sort-foo-tasks”, but you could keep the simple “task” name for the “group-task” field accessor.

I think hash-view
is what I need. :slightly_smiling_face:

Just to confirm, Racket BC does do crazy things with the C stack. You may have more luck with Racket CS.

Are you looking at http://pkgs.racket-lang.org\|pkgs.racket-lang.org? The “failed” link there fails for me, because it has since succeeded as visible at https://pkg-build.racket-lang.org/ . I expect pkgs will catch up soon.

Ah ok, thanks!

Given the semantics of Racket’s call/cc
, would a more accurate name be call-with-noncomposable-continuation
, or call-with-replacement-continuation
?