
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].

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

@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.

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

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

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

Use with-continuation-marks
to test?

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

phase #f
is for-label

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

The expansion happens here: https://github.com/racket/racket/blob/master/racket/collects/racket/private/for.rkt#L1635

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.

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

True.

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.

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

(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))))

The result is '(1 3)

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.

If I remember correctly.

indicating that #:result
is in the tail position

Thanks!

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

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

Nice!

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

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

that behavior is documented

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

@maueroats wanna make a PR?

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.

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.

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

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

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

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?

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

aha, good point

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?

Correct

@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).

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

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

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.

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

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

Formal semantics in general, or talking about continuations?

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?)

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

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

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

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?



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

Yes.

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.

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

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

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

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?