@sorawee You could add flush-outputs in a.rkt; that might help? (Similarly: Use file-stream-buffer-mode on both current-output-port and current-error-port.) But in general I’m not sure there’s a guaranteed order?
To the extent it’s a dependable order, it will probably be because a.rkt “de-multiplexes” the things, using the ordering you want to depend on?
Trying to do it in b.rkt seems less likely to be successful? idk for sure
I am scribbling away and am using @interaction[#:eval eval ...]
to show off some examples.
However comments: ; standard comment
disappear.
Is there a way to write comments inside an interaction form that survives?
@soegaard2 You want code:comment I think: https://docs.racket-lang.org/scribble/scribble_manual_code.html?#%28idx._%28gentag._2._%28lib._scribblings%2Fscribble%2Fscribble..scrbl%29%29%29
@florence Works beautifully. Thanks!
Given that x is a vector, is it possible to write a macro that would take ([] x 1) and produce (vector-ref x 1)?
I think [] won’t work unless you mess with the reader… [] is basically the same as () to the reader
@steveh2009 You can do this I think?
#lang racket
(require (for-syntax syntax/parse/class/paren-shape)
(prefix-in racket/base/ racket/base)
syntax/parse/define)
(define-syntax-parser #%app
[(_ [~brackets] arg ...)
#'(racket/base/#%app vector-ref arg ...)]
[(_ arg ...)
#'(racket/base/#%app arg ...)])
(define v (vector 1 2 3))
([] v 1)(adapted from https://lexi-lambda.github.io/blog/2017/08/12/user-programmable-infix-operators-in-racket/)
@greg not really. a.rkt is in fact a simplification of other people’s program (coqtop, to be precise). Interestingly, Emacs’s Proof General successfully parses the output from coqtop, so the ordering is “stable” enough to be used in real software.