laurent.orseau
2021-2-28 08:33:47

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


raoul.schorer
2021-2-28 12:02:01

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?


spdegabrielle
2021-2-28 12:11:06

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.


mflatt
2021-2-28 13:00:47

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


soegaard2
2021-2-28 13:17:28

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


soegaard2
2021-2-28 13:18:16

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


soegaard2
2021-2-28 13:18:38

This is Chrome on macOS.


soegaard2
2021-2-28 13:19:00

On purpose?


spdegabrielle
2021-2-28 13:29:21

Looks like this to me


spdegabrielle
2021-2-28 13:29:55

safari


spdegabrielle
2021-2-28 13:31:11

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


spdegabrielle
2021-2-28 13:31:39

Is it ok to keep using it.


spdegabrielle
2021-2-28 13:32:25

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


spdegabrielle
2021-2-28 13:35:23

maybe it needs a refresh


spdegabrielle
2021-2-28 13:36:54

banner requirements:


spdegabrielle
2021-2-28 13:37:07

Submissions welcome!


spdegabrielle
2021-2-28 13:39:34

I tried medium


soegaard2
2021-2-28 13:42:50

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


soegaard2
2021-2-28 13:43:37

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


spdegabrielle
2021-2-28 13:43:58

try refresh now I’ve changed it to medium.


spdegabrielle
2021-2-28 13:44:43

or submit an image 4000x64 as a replacement?


soegaard2
2021-2-28 13:45:25

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


soegaard2
2021-2-28 13:45:35

Will a svg work?


spdegabrielle
2021-2-28 13:46:36

let me check


spdegabrielle
2021-2-28 13:52:41

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


soegaard2
2021-2-28 13:52:59

Ok. png it is.


spdegabrielle
2021-2-28 13:58:57

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


adrian.stratulat91
2021-2-28 16:37:40

@adrian.stratulat91 has joined the channel


joel
2021-2-28 17:36:04

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


soegaard2
2021-2-28 17:37:51

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


soegaard2
2021-2-28 17:38:22

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


joel
2021-2-28 17:39:38

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


soegaard2
2021-2-28 17:40:42

That was unexpected :astonished:


soegaard2
2021-2-28 17:41:38

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


mflatt
2021-2-28 17:42:02

Does #,(name) work?


joel
2021-2-28 17:48:25

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


mflatt
2021-2-28 17:49:12

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


joel
2021-2-28 17:53:09

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


joel
2021-2-28 17:58:15

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


mflatt
2021-2-28 18:01:19

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.


adrian.stratulat91
2021-2-28 18:56:49

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


soegaard2
2021-2-28 18:58:16

@adrian.stratulat91 Have you tried disabling the JIT?


adrian.stratulat91
2021-2-28 18:59:11

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


soegaard2
2021-2-28 19:00:48

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


soegaard2
2021-2-28 19:01:35

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


adrian.stratulat91
2021-2-28 19:06:37

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.


soegaard2
2021-2-28 19:07:49

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.



adrian.stratulat91
2021-2-28 19:09:01

Ooh, interesting!


sschwarzer
2021-2-28 19:11:59

@sschwarzer has joined the channel


sschwarzer
2021-2-28 19:17:41

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?


sschwarzer
2021-2-28 19:18:32

And by the way, hello everyone. :slightly_smiling_face:


soegaard2
2021-2-28 19:19:39

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


soegaard2
2021-2-28 19:20:21

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


sschwarzer
2021-2-28 19:22:31

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


sschwarzer
2021-2-28 19:23:08

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


soegaard2
2021-2-28 19:23:29

Great to have you onboard!


sschwarzer
2021-2-28 19:23:48

@soegaard2 :slightly_smiling_face:


sschwarzer
2021-2-28 19:24:54

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.


sschwarzer
2021-2-28 19:25:33

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


soegaard2
2021-2-28 19:25:41

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


sschwarzer
2021-2-28 19:26:10

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


sschwarzer
2021-2-28 19:27:08

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.


laurent.orseau
2021-2-28 19:30:17

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


sschwarzer
2021-2-28 19:36:18

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.


soegaard2
2021-2-28 19:38:29

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


sschwarzer
2021-2-28 19:39:25

Let me check again. …


sschwarzer
2021-2-28 19:42:12

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


sschwarzer
2021-2-28 19:42:50

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


sschwarzer
2021-2-28 19:43:06

both programs processed with raco exe


sschwarzer
2021-2-28 19:43:31

This is with Racket 8.0 on Fedora Linux 33.


sschwarzer
2021-2-28 19:44:18

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


hectometrocuadrado
2021-2-28 19:46:11

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.


soegaard2
2021-2-28 19:46:48

Thanks for checking.


sschwarzer
2021-2-28 19:47:08

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


hectometrocuadrado
2021-2-28 19:47:21

Executed with DrRacket


sorawee
2021-2-28 19:47:44

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


sorawee
2021-2-28 19:48:06

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


sschwarzer
2021-2-28 19:48:31

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


sschwarzer
2021-2-28 19:49:20

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


sorawee
2021-2-28 19:49:54

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


soegaard2
2021-2-28 19:50:11

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


hectometrocuadrado
2021-2-28 19:53:07

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


hectometrocuadrado
2021-2-28 19:53:40

I really dont know anything about how is Racket made.


soegaard2
2021-2-28 19:55:05

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


soegaard2
2021-2-28 19:56:17

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


sschwarzer
2021-2-28 19:56:19

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


soegaard2
2021-2-28 19:57:10

Yes.


hectometrocuadrado
2021-2-28 19:57:42

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


hectometrocuadrado
2021-2-28 19:58:48

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


sschwarzer
2021-2-28 19:59:33

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


sschwarzer
2021-2-28 20:00:05

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


soegaard2
2021-2-28 20:01:00

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


hectometrocuadrado
2021-2-28 20:01:12

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


soegaard2
2021-2-28 20:01:14

The parts colored black haven’t been tested.


sschwarzer
2021-2-28 20:01:27

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.


soegaard2
2021-2-28 20:01:46

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


hectometrocuadrado
2021-2-28 20:02:11

Oh, that looks cool


sschwarzer
2021-2-28 20:04:43

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


hectometrocuadrado
2021-2-28 20:05:36

@sschwarzer I’ll keep it in mind


sschwarzer
2021-2-28 20:07:58

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.


sschwarzer
2021-2-28 20:09:05

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.


sschwarzer
2021-2-28 20:11:14

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 0s (number of failed tests), which I currently filter out with \| grep -v '^0$' :wink:


sschwarzer
2021-2-28 20:12:02

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


spdegabrielle
2021-2-28 20:15:35

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.


sschwarzer
2021-2-28 20:18:52

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


soegaard2
2021-2-28 20:31:48

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


sschwarzer
2021-2-28 21:05:42

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"


sschwarzer
2021-2-28 21:05:56

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


sschwarzer
2021-2-28 21:07:13

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


sschwarzer
2021-2-28 21:08:06

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


samth
2021-2-28 21:12:02

No, the field names are not there at run time


samth
2021-2-28 21:12:44

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


sschwarzer
2021-2-28 21:13:01

Hm, makes sense (no runtime field names).


sschwarzer
2021-2-28 21:13:50

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


sschwarzer
2021-2-28 21:16:35

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



joel
2021-2-28 21:26:13

Actually I think I misread what you were trying to do


joel
2021-2-28 21:27:12

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


joel
2021-2-28 21:30:48

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?


sschwarzer
2021-2-28 21:31:20

I’ll look into it, thank you.


sschwarzer
2021-2-28 21:31:53

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


notjack
2021-2-28 21:32:14

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.


sschwarzer
2021-2-28 21:44:06

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


mflatt
2021-2-28 22:08:04

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


mflatt
2021-2-28 22:16:13

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.


joel
2021-2-28 22:42:02

Ah ok, thanks!


kellysmith12.21
2021-3-1 02:24:57

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