Macro to use “λ” character as “lambda” in R5RS Scheme?
From http://stackoverflow.com/a/26570837/144020 I tried the following:
(define-syntax λ (syntax-rules () ((_ param body ...) (lambda param body ...)))) It works! but ONLY IF you call the script from the gsi not with #!/usr/bin/env scheme-r5rs Does anyone know I can set the command line OPTION s|S "set standard Scheme mode" from within a scheme file??
Afficher les réponses par date
Might be character encoding issue depending on if terminal/file input and Gambit command line arguments? 2014-10-26 19:20 GMT+01:00 Roy Pfund <roypfund@gmail.com>:
From http://stackoverflow.com/a/26570837/144020 I tried the following:
(define-syntax λ (syntax-rules () ((_ param body ...) (lambda param body ...))))
It works! but ONLY IF you call the script from the gsi not with
#!/usr/bin/env scheme-r5rs
Does anyone know I can set the command line OPTION s|S "set standard Scheme mode" from within a scheme file??
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
There is an emacs lisp file floating around, pretty-lambda.el, which does precisely that. However, it only works within emacs... On Oct 26, 2014 12:20 PM, "Roy Pfund" <roypfund@gmail.com> wrote:
From http://stackoverflow.com/a/26570837/144020 I tried the following:
(define-syntax λ (syntax-rules () ((_ param body ...) (lambda param body ...))))
It works! but ONLY IF you call the script from the gsi not with
#!/usr/bin/env scheme-r5rs
Does anyone know I can set the command line OPTION s|S "set standard Scheme mode" from within a scheme file??
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
I know its not exactly what you asked for, but I found this gambit specific trick recently. (##include "~~/lib/_gambit#.scm") (define-runtime-syntax λ (##make-alias-syntax '##lambda)) Which you can use as normal:
(define square (λ (x) (* x x))) square #<procedure #2 square> (square 42) 1764
James On Mon, Oct 27, 2014 at 5:20 AM, Roy Pfund <roypfund@gmail.com> wrote:
From http://stackoverflow.com/a/26570837/144020 I tried the following:
(define-syntax λ (syntax-rules () ((_ param body ...) (lambda param body ...))))
It works! but ONLY IF you call the script from the gsi not with
#!/usr/bin/env scheme-r5rs
Does anyone know I can set the command line OPTION s|S "set standard Scheme mode" from within a scheme file??
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
participants (4)
-
Colin Gilbert -
James Baker -
Mikael -
Roy Pfund