laurent.orseau
2021-7-12 12:52:56

[scribble] is it possible to typeset a (long) list of identifier+value definitions as a table, rather than a as sequence of defthing? It’s for a long list of identifiers that are bound to unicode characters (as strings). I want to display them in a table, and use the table as the scribble definition sites. I tried indexed-racket, but it seems that index only creates an entry, not a definition site IIUC.


soegaard2
2021-7-12 12:55:41

I am using defidentifier to set the definition site for functions in the Sketching docs. Maybe that can be used? (I am trying a different style of documentation than usual).


laurent.orseau
2021-7-12 13:04:26

That works, thanks @soegaard2! The default style is indeed not ideal, but at least that’s a start :slightly_smiling_face:



greg
2021-7-12 13:25:44

That could be modified to add a hint like "\nMaybe you need to (require (for-syntax (racket/base)))?"


laurent.orseau
2021-7-12 13:26:33

Depending on gotchas, i think that would be a good idea.


greg
2021-7-12 13:26:56

Do you want to open an issue or PR, or should I?


laurent.orseau
2021-7-12 13:29:10

go ahead, unless you prefer I do it, or you don’t have time



laurent.orseau
2021-7-12 14:17:24

Thanks greg!


shu--hung
2021-7-12 14:21:34

Nice! I think adding special error message for phase 1 is a good idea.


shu--hung
2021-7-12 14:52:47

I’m also confused by the error message

X: unbound identifier, and X: undefined

and I wonder why isn’t the error message something like

expander: the identifier X is unbound (in phase NN) and runtime: the value of X is undefined


ben.knoble
2021-7-12 17:38:06

Is there a way to unbuffer output from (e.g.) displayln? The ouput from a Racket program appears to buffer on GitHub actions, while most other programs don’t (and it looks fine locally, ofc)


soegaard2
2021-7-12 17:38:48

Unbuffer? Do you mean flush?


ben.knoble
2021-7-12 17:40:31

Perhaps—I guess I mean “make sure output from displayln shows up in real time in GitHub actions.” I’m assuming it’s a buffer/flush problem, but I’m not sure how to test/fix that


greg
2021-7-12 17:40:45

Maybe file-stream-buffer-mode ?


greg
2021-7-12 17:41:34

Something like (file-stream-buffer-mode (current-output-port) 'line)?


greg
2021-7-12 17:41:42

Or 'none


greg
2021-7-12 17:41:52

Maybe also current-error-port


ben.knoble
2021-7-12 17:43:27

That looks right—the default is 'block for output-ports, unless it’s a terminal (probably istty or equivalent is true). Now, can I inject that from the command-line? Something like racket -e "(file-stream-buffer-mode (current-output-port) 'line)" my-program.rkt <args>? The -h makes me believe so, but


ben.knoble
2021-7-12 17:44:43

Or, probably better, run multiple files in a row :thinking_face:


samdphillips
2021-7-12 17:45:01

I just set those in my script.


samdphillips
2021-7-12 17:45:15

Which may or may not be possible for you


greg
2021-7-12 17:46:38

I’ve also only done that in a Racket program, not “to” it from the command-line. I wonder if something like env var TERM=1 would make Racket think istty or whatever? Not sure.


ben.knoble
2021-7-12 17:47:52

Gar, I can’t get variations of racket unbuffer.rkt prog.rkt to work, where unbuffer sets the modes and prog prints them. Silliness.


greg
2021-7-12 17:50:54

If the coreutils stdbuf program is available in GitHub Actions, you could use that to run Racket, maybe?


greg
2021-7-12 17:51:13

(that suggestion is based on my extensive experience googling this topic for about 2 minutes so beware :smile:)


ben.knoble
2021-7-12 17:51:24

I was hoping to only do this in GitHub actions, where it’s not necessary elsewhere. I suppose I could write a quick wrapper for the program to only do this. sigh



ben.knoble
2021-7-12 17:53:37

GOT IT—you have to use -t. No other flag combo seems to work. https://docs.racket-lang.org/guide/racket.html#%28part._start-module-mode%29


samth
2021-7-12 17:54:45

racket foo.rkt bar.rkt passes "bar.rkt" as the first command line argument to foo.rkt


ben.knoble
2021-7-12 17:58:12

Yeah, I was trying -e foo.rkt -e bar.rkt, and the various other “run things” flags, but only -t works


ben.knoble
2021-7-12 17:58:39

^and does support <args> after bar.rkt


samth
2021-7-12 18:01:09

yes, -e is “evaulate this expression”