samth
2021-6-21 13:29:08

That is super-cool


jesse697
2021-6-21 14:40:27

on https://github.com/racket/racket/releases, 8.0 is marked as the latest release. Should be 8.1, right? 8.1 is there, it’s just not marked as the latest (and there are no notes)


sorawee
2021-6-21 14:42:15

IIRC @samth said that the 8.0 release on GitHub was just an experiment. That’s why there’s no 8.1.

I do agree that it’s confusing though.


samth
2021-6-21 14:42:47

Yeah, I’m not sure what the right thing to do is. Maybe I should just add the release announcement/add a task to do that every release


samth
2021-6-21 14:55:37

I created the release


samth
2021-6-21 14:55:40

for 8.1


gknauth
2021-6-21 16:09:21

Maybe I’m thick today … in the GUI, get-selection returns a number, I want the string (from the list of choices in choice%). How?



gknauth
2021-6-21 16:12:29

That was it @soegaard2! Thanks! I forgot to look in the superclass.


soegaard2
2021-6-21 16:14:02

A “cheat sheet” at the top or bottom of the gui elements would make it easier to spot methods.

https://docs.racket-lang.org/racket-cheat/index.html?q=cheat


kyp0717
2021-6-21 16:26:47

Hello. Can someone help me understand the following code for running on command line? More specific, I am confused by the fact that the parser procedure is never called but yet the program works. Please advise. #! usr/bin/env racket #lang racket ;; parameter My-Name is one of: ;; - #false ;; - String (define my-name (make-parameter #false)) ;; command line parser (define parser (command-line #:usage-help "Have the computer greet you!" #:once-each [("-n" "--name") NAME "Set your name" (my-name NAME)] #:args () (void))) ;; get-greeting : My-Name -> String ;; Gets the greeting for the given My-Name (define (get-greeting mn) (cond [(boolean? mn) "Hello, unknown person!"] [(string? mn) (string-append "Hello, " mn "!")])) ;; prints result to the command line (printf "~a\n" (get-greeting (my-name)))


samth
2021-6-21 16:28:24

parser is not a procedure, it’s just a value, and the right hand side of the definition is run when you run the program. That means that (my-name NAME) gets run and sets that parameter.


laurent.orseau
2021-6-21 16:29:21

What makes it work is that command-line is called.


kyp0717
2021-6-21 16:31:54

Ahhh… I get it now! parser is a definition not a procedure (my mixed up).


kyp0717
2021-6-21 16:33:59

hmm…So why is it done this way? Why create the parser definition? Seems like an extra step.


samth
2021-6-21 16:34:49

What is this code from?



samth
2021-6-21 16:37:29

I don’t know why he wrote it that way


samth
2021-6-21 16:38:01

The command-line form can produce values as well, so such a definition can be useful, but it isn’t in this example


kyp0717
2021-6-21 16:39:38

ok..thanks!


ben.knoble
2021-6-21 17:25:46

For an alternate peek, though with less command-line options to parse, see https://github.com/benknoble/slack-archive-viewer/blob/ff440edd9f59664ef13985acb827af939f9bbce6/unpack.rkt#L108 or https://github.com/benknoble/slack-archive-viewer/blob/ff440edd9f59664ef13985acb827af939f9bbce6/merge-meta.rkt#L249 where I define a run-main function and then in a submodule main call command-line to parse arguments and give them to run-main. The main submodule is automatically required when you do racket <file> , if one exists (right?). This works for me with #! scripts too