hello,
this could be a joke (and i like that ) but it is not one...
i have a SRFI-105 curly infix reader that works in Racket GUI and CLI (command line interface) too... but for a weird reason the same code does not put a Carriage Return in the command line mode in a terminal.
I tested both in Linux and Mac OS:
here is the behavior:
mattei@acer:~/Dropbox/git/SRFI-105-for-Racket$ racket
Welcome to Racket v8.14 [cs].
> (require "main.rkt")
> {1 + 1}
(+ 1 1)
#<eof>
2
the main.rkt contain the main procedures of SRFI 105 Curly infix parser and i have to add some CR and more (newline) to make it works:
;; the current read interaction handler, which is procedure that takes an arbitrary value and an input port
(define (literal-read-syntax-for-repl src in)
(define result (curly-infix-read in))
;; usefull only in CLI
(newline)
(write-char (integer->char 13)) ; put a Carriage Return
(pretty-print result
(current-output-port)
1)
(if (eof-object? result)
;;(begin (display "eof") (newline) result)
result
(datum->syntax #f result))) ;; current-eval wait for a syntax object to pass to eval-syntax for evaluation
Now it is ok in CLI:
mattei@acer:~/Dropbox/git/SRFI-105-for-Racket$ racket
Welcome to Racket v8.14 [cs].
> (require "main.rkt")
> {1 + 1}
(+ 1 1)
#<eof>
2
but as a consequence i have extra new lines in the GUI where the same code worked without problem:
Welcome to DrRacket, version 8.14 [cs].
Language: reader SRFI-105, with debugging; memory limit: 8192 MB.
SRFI-105 Curly Infix parser for Racket Scheme by Damien MATTEI
(based on code from David A. Wheeler and Alan Manuel K. Gloria.)
Possibly skipping some header's lines containing space,tabs,new line,etc or comments.
SRFI-105.rkt : number of skipped lines (comments, spaces, directives,...) at header's beginning : 8
Parsed curly infix code result =
(module Racket-SRFI-105-REPL racket (provide (all-defined-out)))
> {1 + 1}
(+ 1 1)
2
#<eof>
>
i think the CLI and GUI behavior should be matching in Racket but that depends of Racket source code, not mine.
A solution would be to have a way to autodetect CLI mode versus GUI mode in my code but i do not know how to do it?
another bad joke.... depending the way to launch the code i have or not syntax in color enlighting, see the screen shot of terminal and code:
regards,
damien