greg
2018-12-29 16:52:00

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


greg
2018-12-29 16:53:08

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?


greg
2018-12-29 16:54:05

Trying to do it in b.rkt seems less likely to be successful? idk for sure


soegaard2
2018-12-29 17:19:12

I am scribbling away and am using @interaction[#:eval eval ...]


soegaard2
2018-12-29 17:19:20

to show off some examples.


soegaard2
2018-12-29 17:19:39

However comments: ; standard comment


soegaard2
2018-12-29 17:19:42

disappear.


soegaard2
2018-12-29 17:20:08

Is there a way to write comments inside an interaction form that survives?



soegaard2
2018-12-29 20:34:44

@florence Works beautifully. Thanks!


steveh2009
2018-12-30 01:02:39

Given that x is a vector, is it possible to write a macro that would take ([] x 1) and produce (vector-ref x 1)?


andreiformiga
2018-12-30 01:53:05

I think [] won’t work unless you mess with the reader… [] is basically the same as () to the reader


sorawee
2018-12-30 02:05:41

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


sorawee
2018-12-30 02:10:16

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