willbanders
2019-11-3 18:35:48

Does Racket have anything akin to null coalescing?


soegaard2
2019-11-3 19:00:29

which means?


soegaard2
2019-11-3 19:01:40

Are you thinking of #f used with or ?


willbanders
2019-11-3 19:48:03

Basically (if (null? x) default x)


willbanders
2019-11-3 19:48:24

I can’t use something like #f in this case because that’s a valid value.


soegaard2
2019-11-3 19:49:10

Nothing builtin. Best idea: write a macro or/null.


sorawee
2019-11-4 04:20:16

@samdphillips just to let you know: I submitted a patch yesterday.


sorawee
2019-11-4 04:21:54

Hmm. In Python, if I ctrl-c when it’s prompting for an input (via input()), the KeyboardInterrupt is raised immediately. For Racket, when I’m in (read-line), ctrl-c doesn’t take an effect until I type something and hit enter. How can I get Python’s behavior?


samdphillips
2019-11-4 04:56:05

sorawee
2019-11-4 05:30:52

Oh, that’s a previous version that turns out to break a lot of tests (it converts integer entities in bodies too). The fix is actually here: https://github.com/racket/racket/blob/master/racket/collects/xml/private/reader.rkt#L305


samdphillips
2019-11-4 06:06:19

Oh cool. I missed the follow up commits.