laurent.orseau
2020-8-27 08:40:30

Plied Lambda Twentifold


spdegabrielle
2020-8-27 10:55:58

In my defence I couldn’t resist. @soegaard2 LURED me with the promise of Racket content.


bedeke
2020-8-27 15:58:17

Hi, can someone explain me what this error means? racket-7.8.0.9/share/pkgs/typed-racket-lib/typed-racket/infer/promote-demote.rkt:32:0: Rep-variances: contract violation: expected: Rep? given: #f argument position: 1st I get this with following program #lang typed/racket/base (require racket/sequence) (define (fun [vs : (U (Sequenceof (Sequenceof Real)) (Sequenceof (Sequenceof (Sequenceof Real))))]) (for/fold ([result : (Option (Listof (Pair (Vectorof Real)(Vectorof Real)))) '()] [firstok : Boolean #f] #:result result) ([s vs] #:break (not result)) (define l (sequence->list s)) (cond [(and firstok (= (length l) 2) (sequence? (car l))) (values (cons (cons (list->vector (sequence->list (car l))) (list->vector (sequence->list (cadr l)))) result) firstok)] [firstok (raise-argument-error 'arrows "Sequence of Sequence (of 2 elements) of Sequence (of 2 Reals)" vs)] [(and (= (length l) 2) (sequence? (car l))) (values (cons (cons (list->vector (sequence->list (car l))) (list->vector (sequence->list (cadr l)))) result) #t)] [else (values #f #f)])))


samth
2020-8-27 15:58:54

That’s a typed racket bug


samth
2020-8-27 15:59:01

by definition


bedeke
2020-8-27 16:00:49

Should I make a report?


samth
2020-8-27 16:12:38

Yes


pavpanchekha
2020-8-27 19:14:27

So it looks like for simple syntax error (like unbound identifiers) Racket offers a stack trace that contains a lot of temporary functions and the guts of the macro expander. Is there any way to hide those? I feel like they cause beginners to distrust Racket error messages


sorawee
2020-8-27 19:17:24

Or any stack trace in general. Here’s one I got recently:

p call-in-empty-metacontinuation-frame check-break-prefix call-with-empty-metacontinuation-frame-for-swap l loop dynamic-wind temp52_0 /Users/sorawee/git/racket/racket/collects/setup/parallel-do.rkt:236:4 dynamic-wind /Users/sorawee/git/racket/pkgs/racket-index/setup/scribble.rkt:138:0: setup-scribblings call-in-empty-metacontinuation-frame winder-dummy /Users/sorawee/git/racket/racket/collects/setup/setup-core.rkt:72:0: setup-core call-in-empty-metacontinuation-frame body of "/Users/sorawee/git/racket/racket/collects/setup/main.rkt" Probably l, p, and temp52_0 could be elided.


samth
2020-8-27 19:26:56

I think an algorithm for how to tell is the main thing missing.


pavpanchekha
2020-8-27 19:42:43

Don’t show stack traces for bugs beginners usually have, and add a command line flags that Racket devs can use to see the guts when they’re working on the macro expander?


samth
2020-8-27 19:43:40

For syntax errors I think the “no stack trace” approach is reasonable; I was more thinking of @sorawee’s comment


samth
2020-8-27 19:45:00

Although the trouble with exn:fail:syntax doesn’t print stack traces is that plenty of syntax errors don’t have good source locations, in which case it’s hopeless


samth
2020-8-27 19:45:21

But overall, it might well be an improvement.


mflatt
2020-8-27 19:52:28

I can imagine that any code built into the Racket executable could be given a source location that makes it suppressed. That would take care of the expander noise that started showing up when the expander moved to Racket, and the even greater noise in Racket CS. That is, the current implementation of stack traces was set up for a world where built-in things rarely showed up in traces, and we could try moving back to that (without porting the code back to C, obviously).


samth
2020-8-27 19:53:44

@mflatt do you know of instances where the stack trace in an exn:fail:syntax is worth printing the default mode (even apart from the built-in portions)?


mflatt
2020-8-27 19:57:29

It’s sometimes helpful to me where it’s the macro that is broken and the trace helps identify the path to an incorrect or unhelpful error, but my perspective on these points is skewed.


samth
2020-8-27 20:00:46

Right, I think we would definitely want the ability to see those stack traces, but maybe the default printing should be more like exn:fail:user.


sorawee
2020-8-27 20:02:27

Can anyone try this really quick? Run the racket REPL, type a, and hit tab to autocomplete it. Are there any weird entries in it? I found abstractq, abstractQ, arithmetic-shift�, augment*i, and augride*1 in the list.


samth
2020-8-27 20:03:59

I see some weird ones, but not exactly those


mflatt
2020-8-27 20:05:20

I see mangled endings in CS and not BC. It might be that byte strings in CS don’t have an implicit NUL terminator (as exposed by the FFI) like they do in BC.


samth
2020-8-27 20:06:15

That’s what I see too


gknauth
2020-8-27 20:57:13

What’s this autocomplete? I type TAB, I get TAB.


sorawee
2020-8-27 21:05:04

What OS and Racket version are you using? And is it minimal Racket or regular Racket?


thomaswevans
2020-8-27 21:09:25

Nothing happens when I hit TAB here (DrRacket 7.8 on Windows 10).


sorawee
2020-8-27 21:09:42

It must be in command-line, not DrRacket


spdegabrielle
2020-8-27 21:16:06

I don’t get tab autocomplete in DrRacket? (vanilla 7.8 macos catalina)



soegaard2
2020-8-27 21:19:08

Ctrl+/


spdegabrielle
2020-8-27 21:28:15

would love to bind it to tab


spdegabrielle
2020-8-27 21:29:50

Hmm. Tab currently isn’t bound to anything.


spdegabrielle
2020-8-27 21:31:38

alt-tab flips between definitions and interactions Ctrl-tab switches Tab(currently selected file) Tab - noting not even tab characted


sorawee
2020-8-27 21:36:22

Tab in DrRacket is bound to autoindent


spdegabrielle
2020-8-27 21:38:42

I forgot!


spdegabrielle
2020-8-27 21:40:56

yay! I can override tab to indent and get tab to autocomplete #lang s-exp framework/keybinding-lang (keybinding "tab" (λ (editor evt) (send editor auto-complete)))



liquidcloud9
2020-8-27 22:59:17

@liquidcloud9 has joined the channel


liquidcloud9
2020-8-27 23:02:27

Asked this on Reddit, but couldn’t find an answer. Does Racket have something similar to CL’s DESCRIBE and INSPECT?


sorawee
2020-8-27 23:07:13

sorawee
2020-8-27 23:08:26

I implemented a value browser for symbolic terms in Rosette, but it could be used for Racket values as well:

https://docs.racket-lang.org/rosette-guide/sec_utility-libs.html


liquidcloud9
2020-8-27 23:24:39

This is great! Thank you for the help.


anything
2020-8-27 23:57:46

Good evening. If I’d like to disable TLS 1.0, TLS 1.1 and SSL 3.0 in the Racket Web Server, is that possible?


samth
2020-8-28 00:55:49

I don’t think there’s a configuration option for that at the moment.


samth
2020-8-28 00:56:26

Probably you’d need to expose something about ssl contexts from server/servlet and then use ssl-set-cipher


anything
2020-8-28 01:00:08

Thanks, samth. I cross-posted the question to discord.racket.general. Jay McCarthy answered pointing out that I could change web-server-lib/web-server/web-server.rkt, line 74, procedure make-ssl-connect@, which invokes ports->ssl-ports, which belongs to openssl, and has a keyword #:protocol with which we can set the protocols we want to use. (Turns out the documentation mentions keyword #:encrypt, which is wrong. So I’m actually going to fix the documentation. The right question to the catch the doc flaw. :P)


sorawee
2020-8-28 01:24:34

Question probably for @mflatt and @ryanc

Say, I fully expand a syntax object and extract an identifier from it (along with those hidden in 'disappeared-use and 'origin properties) and test free-identifier=? with a similar id from phase 0 in another module

Continued in subthread


sorawee
2020-8-28 01:25:25

Situation 1: When that identifier is syntax-case, and the program is:

#lang racket/base (syntax-case 1 () [_ 2]) I found that (free-identifier=? new-id extracted-id) where new-id = #'syntax-case at (a-phase-level, b-phase-level) = (0, 0) and (1, 1)

Situation 2: consider:

(require (for-syntax racket/base)) (define-syntax (foo stx) (syntax-case 1 () [_ 2])) results in

(free-identifier=? new-id extracted-id) at (a-phase-level, b-phase-level) = (0, 0) and (0, 1)

Situation 3: let’s change the identifier to ~literal from syntax/parse. Doing the same thing with

(require syntax/parse) (syntax-parse 1 [(~literal a) 2]) results in

(free-identifier=? new-id extracted-id) at (a-phase-level, b-phase-level) = (1, 0) and (1, 1)

Situation 4: consider

(require (for-syntax syntax/parse racket/base)) (define-syntax (foo stx) (syntax-parse 1 [(~literal a) 2])) results in

(free-identifier=? new-id extracted-id) at (a-phase-level, b-phase-level) = (0, 0) and (1, 0)


sorawee
2020-8-28 01:25:54

I seem to get different answers in each situation… what’s going on?


sorawee
2020-8-28 01:28:29

I think I understand why situation 1vs2 and 3vs4 give different answers, but I thought 1vs3, and 2vs4 should give similar result. They don’t.


mflatt
2020-8-28 01:36:54

My initial guess is that you’re seeing the effect of phase shifts not reaching properties — one of the problems with having syntax objects in properties. I’d have to look more closely to be sure of that, though.


cris2000.espinoza677
2020-8-28 03:13:15

can someone explain to me escape continuations? from the https://docs.racket-lang.org/reference/cont.html?q=let%2Fec#%28def._%28%28quote._~23~25kernel%29._call-with-escape-continuation%29%29\|documentation , i think it says that you cannot call it from outside the procedure passed to call/ec also i dont get why it matters that it isnt called from tail position… can someone explain to me?


cris2000.espinoza677
2020-8-28 03:13:49

in another note, should there be a #help channel? or would that be overkill?


sorawee
2020-8-28 03:18:08

IIUC, With call/cc, you can save the continuation (e.g., set! a variable to the continuation value) and then invoke it outside of the dynamic extent of call/cc. You can even invoke it multiple times!


notjack
2020-8-28 03:19:25

there’s a #beginners channel, does that work?


sorawee
2020-8-28 03:21:07

This means that racket needs to copy frame information to a data structure so that you can invoke the continuation later


sorawee
2020-8-28 03:22:03

But for call/ec, you are only limited to call it at most once during the dynamic extent of the form


sorawee
2020-8-28 03:23:04

So racket doesn’t need to copy frame information = more efficient


343519265
2020-8-28 03:43:07

I belive in RacketCS the situation is reversed: call/ec is less efficient


cris2000.espinoza677
2020-8-28 04:14:24

oooh ok, thank you!


cris2000.espinoza677
2020-8-28 04:15:02

there was this thread the other way and it makes me wonder https://racket.slack.com/archives/C09L257PY/p1598119755040700


notjack
2020-8-28 04:16:57

asking in #general is probably fine too


alexharsanyi
2020-8-28 06:38:18

While reviewing a pull request for the plot package, the author has used an undocumented feature of skipping lines in a line renderer. Basically, given the code:

#lang racket (require plot) (define skip '(+nan.0 +nan.0)) (plot (lines `((0 0) (1 1) (2 -1) (3 1) ,skip (4 -1) (5 1) (6 -1)) #:y-min -2 #:y-max 2)) it will produce the following plot


alexharsanyi
2020-8-28 06:39:33

alexharsanyi
2020-8-28 06:41:27

Looking at the source code, this seems to be to be unintended behavior, and I am wondering if anyone knows about it?


alexharsanyi
2020-8-28 06:44:13

BTW, if you just learned about this from my message, don’t use it — I intend to keep this as undocumented behavior and might change in the future. If you need two sets of lines on the plot, you can already do that by using lines twice.