sorawee
2020-7-31 07:31:52

I just ran RACKETCS_SUFFIX="" make cs but that somehow builds both 3m and cs, with 3m being broken, and with the CS variant having suffix cs.

The error from running racket is:

dyld: Library not loaded: @executable_path/../lib/Racket.framework/Versions/7.8.0.5_3m/Racket It’s especially weird because the version should have been 7.8.0.6.

racketcs on the other hand works fine:

Welcome to Racket v7.8.0.6 [cs].


sorawee
2020-7-31 08:49:44

Looks like it’s a stale build problem. I clean the repo and rebuild again and it seems to work fine now


soegaard2
2020-7-31 09:02:58

@gknauth It would be great if you can get flomat to run on Windows. After installing CBLAS and LAPACK you need to edit https://github.com/soegaard/sci/blob/master/flomat/flomat.rkt#L96

Wrt which versions of the libraries to install: One option is to install Numpy/Scipy which include CBLAS and LAPACK.

I notice that the Python libraries include a list of options in their build instructions. It seems they prefer MKL from Intel.

https://numpy.org/devdocs/user/building.html


spdegabrielle
2020-7-31 09:48:32

“QuickScript is amazing, btw — chapeau !” - comment from participant in the DrRacket @racketlang Quickscript Competition (unofficial)


laurent.orseau
2020-7-31 12:53:35

Does anyone know if the #:result clause of for/fold is evaluated in tail-position?


soegaard2
2020-7-31 12:54:07

Good question - best bet is to look at the expansion.


sorawee
2020-7-31 12:54:12

Use with-continuation-marks to test?


sorawee
2020-7-31 12:54:42

@mflatt what’s the meaning of phase = #f in syntax-debug-info? Similarly, what’s the meaning of all-bindings??


mflatt
2020-7-31 12:55:14

phase #f is for-label


mflatt
2020-7-31 12:55:40

I don’t remember offhand where all-bindings shows up; can you show somme example output?



sorawee
2020-7-31 12:57:51

Ah, I see. Thanks!

When I set all-bindings? to #t in my setting, it outputs the same as when it’s #f, so I don’t think that’s gonna be helpful to you.


laurent.orseau
2020-7-31 12:58:55

Thanks. for/fold is a beast though, so not easy to know for sure when looking at the code


soegaard2
2020-7-31 12:59:24

True.


laurent.orseau
2020-7-31 13:01:16

Not sure how to do that here. #:result is the certainly the last thing evaluated, but it doesn’t mean that there isn’t some hidden cleanup afterwards. I’m not sure how to use with-continuation-marks to know if there’s such a hidden thing.


laurent.orseau
2020-7-31 13:02:32

I would frankly be surprised if it was not in tail position though.


sorawee
2020-7-31 13:06:40

(with-continuation-mark 'k 3 (values (with-continuation-mark 'k 2 (for/fold ([a 0] #:result (with-continuation-mark 'k 1 (continuation-mark-set->list (current-continuation-marks) 'k))) () 1))))


sorawee
2020-7-31 13:06:47

The result is '(1 3)


mflatt
2020-7-31 13:06:47

Oh, those are arguments to syntax-debug-info… Setting all-bindings? to #t will add bindings to the output that happen to be found but are only reachable with scopes different than the ones on the syntax object.


mflatt
2020-7-31 13:06:58

If I remember correctly.


sorawee
2020-7-31 13:07:08

indicating that #:result is in the tail position


sorawee
2020-7-31 13:07:42

Thanks!


sorawee
2020-7-31 13:08:21

If it’s not, then 2 would also be included


sorawee
2020-7-31 13:10:07

If there is hidden thing, then it couldn’t be in the tail position, could it?


laurent.orseau
2020-7-31 13:22:18

Nice!


laurent.orseau
2020-7-31 13:23:01

I had never paid attention to the fact that (values (proc)) makes the call not in tail position :thinking_face:


laurent.orseau
2020-7-31 13:23:47

However, this example may be due to a particular optimization of the compiler. I’d prefer a documented guarantee :slightly_smiling_face:


samth
2020-7-31 14:26:00

that behavior is documented


samth
2020-7-31 14:26:21

ie, the semantics of wcm mean that’s an appropriate test


sorawee
2020-7-31 14:26:32

@maueroats wanna make a PR?


sorawee
2020-7-31 14:31:00

I understand @laurent.orseau’s response as: the behavior of the tail position of for/fold is not documented. It could be the case that due to the shape of #:result, sometimes the optimizer makes it a tail position, while other shapes would expand to a non-tail position.


laurent.orseau
2020-7-31 14:32:17

For for/fold, it is only said that: > When iteration terminates, if a _result-expr_ is provided then the result of the <file:///usr/share/racket–7.7.0.4/doc/reference/for.html?q=for%2Ffold#%28form._%28%28lib.racket%2Fprivate%2Fbase..rkt%29.for%2Ffold%29%29|for/fold> is the result of evaluating _result-expr (with _accum-id_s in scope and bound to their final values), otherwise the results of the <file:///usr/share/racket–7.7.0.4/doc/reference/for.html?q=for%2Ffold#%28form.%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for%2Ffold%29%29|for/fold> expression are the accumulator values.


samth
2020-7-31 14:32:44

It’s possible that the expansion of for/fold could sometimes put the #:result in tail position or not, but the optimizer does not change tail positions in an observable way


laurent.orseau
2020-7-31 14:33:18

Oooh, that’s pretty cool! Is that guarantee documented somewhere?


laurent.orseau
2020-7-31 14:33:57

Although I’m surprised that the optimizer doesn’t turn some non-tail position into tail position when possible.


sorawee
2020-7-31 14:34:37

Preserving tail position means that even if the compiler can prove that x produces a single value, it can’t turn (values x) to x. Is that a good thing?


samth
2020-7-31 14:35:16

Well, it can do that if it proves that the expression x doesn’t observe the continuation


laurent.orseau
2020-7-31 14:36:11

aha, good point


laurent.orseau
2020-7-31 14:38:35

And therefore, since it does observe the continuation, if it says it is in tail position after some optimization then this means it must have been in tail position also before the optimization. Correct?


samth
2020-7-31 14:38:49

Correct


gknauth
2020-7-31 14:43:50

@soegaard2 I’ll try that, since I definitely have the latest Python. I made sure of that when I tried out Asymptote. I use the command line version, and I’m still learning the syntax of .asy files. I thought I’d try the GUI, which required pip3 installation of some Python package. I didn’t bother with the GUI though. I started generating .svg files, then found out / remembered just how bad SVG support is compared to early-days promises, that led me to in-browser svg-edit, which is pretty slick, … It’s been quite the adventure so far. But I really want to have something solid in Racket. Today’s presentation is going to be a hodgepodge (talk is at noon, 77 mins. away), but I’m looking forward to revising it with cool live controls courtesy of Racket (and OpenGL).


gknauth
2020-7-31 14:44:45

It will be interesting to see how a Racket module discovers CBLAS/LAPACK in a Python installation on a Win10 system…


laurent.orseau
2020-7-31 14:44:58

Feels like a formal proof is within my reach… How do you formalize “expression x can observe the continuation”?


soegaard2
2020-7-31 14:50:37

I didn’t even know there were a GUI for Asymptote nor that there is an svg-edit. FWIW I usually produce svg-files from Metapict and put them in web pages. That seems to work fine.


samth
2020-7-31 15:59:11

the easiest way to describe it is to say that E behaves the same in any two continuations C and C’


laurent.orseau
2020-7-31 17:00:28

To avoid wasting more of your time, what would be the best intro to these formal semantics?


samth
2020-7-31 17:03:08

Formal semantics in general, or talking about continuations?


laurent.orseau
2020-7-31 17:04:23

Maybe best to start with the roots, so the former I guess. Plus the Reference has some papers on continuations (Felleisen88 may be a good start after the basics?)


laurent.orseau
2020-7-31 17:27:08

Basically I need to have a good understanding of the properties of E[ ] and related objects before anything else I guess


samth
2020-7-31 17:30:20

The best thing for that is the Redex book, I think


sorawee
2020-7-31 18:42:53

Is there any existing work on repairing program AST in a language with macro expansion?


yilin.wei10
2020-7-31 20:08:00

Hello, I’m trying to understand how racket deals with syntax highlighting (specifically using #slideshow. There’s the comment at the bottom of pict-block-code which states that it highlights using the “code’s language’s lexer” with particular predefined token classes. This makes sense to me, but I can’t understand how this maps to lexers written using <https://docs.racket-lang.org/parser-tools/Lexers.html#%28part..Creating_a.Lexer%29|parser-tools. >Does it mean my tokens using define-tokens need to be specifically named or something entirely different?




yilin.wei10
2020-7-31 20:13:26

Interesting; does that mean that the color-lex usually has nothing to do with the general lexer?


soegaard2
2020-7-31 20:13:37

Yes.


yilin.wei10
2020-7-31 20:15:19

Oh wow; OK. Is there’s a particular place I can read up on the rationale behind it? My first reaction is that it seems odd that they have nothing to do with each other.


soegaard2
2020-7-31 20:15:27

Well. It often it shares rules with the standard lexer.


yilin.wei10
2020-7-31 20:15:42

Yes I can see in the sample - thanks for that, it’s really useful.


soegaard2
2020-7-31 20:16:28

The colorer needs less information. Just the category and the the from-to positions. That’s enough to color the text.


yilin.wei10
2020-7-31 22:31:35

Hmm. Something which is interesting is that the (racket-lexer) only returns a single lexeme - does that mean that there would be no real way to have contextual highlighting inside the editor? For example if I wanted to use typed/racket and wanted the types to have a separate colour scheme?