Hello,
Totally new to Gambit-Scheme (and mostly new to Lisp/Scheme in general). I just installed Gambit-C, precisely for learning, and started to try the REPL. Here is an example of what I get:
======================= spir@d:~$ gsi Gambit v4.2.8
(define var 9) (display var)
9>
(define var2 10)
(define (double x) (+ x x)) (double 3)
6
(display double)
#<procedure #2 double>> (define var3 11)
=======================
0) No feedback at all for 'define'. (OK) 1) New prompt not separated from output of previous command. 2) Key-presses of <enter> do not generate new prompt.
Is all of this intended behaviour? Or what do I miss?
Denis
Afficher les réponses par date
On Tue, 1 Mar 2011, spir denis.spir@gmail.com wrote:
Hello,
Totally new to Gambit-Scheme (and mostly new to Lisp/Scheme in general). I just installed Gambit-C, precisely for learning, and started to try the REPL. Here is an example of what I get:
======================= spir@d:~$ gsi Gambit v4.2.8
(define var 9) (display var)
9>
(define var2 10)
(define (double x) (+ x x)) (double 3)
6
(display double)
#<procedure #2 double>> (define var3 11)
=======================
- No feedback at all for 'define'. (OK)
- New prompt not separated from output of previous command.
- Key-presses of <enter> do not generate new prompt.
Is all of this intended behaviour? Or what do I miss?
Denis
Please forgive me for not answering your question directly.
I usually run my Scheme repls under Quack running on Emacs. I think the faculties thus provided do help in designing/writing code.
http://www.neilvandyke.org/quack
There are sometime unexpected, to me at least, placements of stuff printed to the screen, even when running Quack/Emacs.
oo--JS.
-- _________________ vita es estrany spir.wikidot.com
On Tue, Mar 1, 2011 at 1:20 PM, spir denis.spir@gmail.com wrote:
- No feedback at all for 'define'. (OK)
- New prompt not separated from output of previous command.
- Key-presses of <enter> do not generate new prompt.
Is all of this intended behaviour? Or what do I miss?
0) This is normal, yes. 1) (display ...) does not include an implicit newline; you must explicitly give a newline character or call (newline) for this:
> (display "something\n") something > (begin (display "something") (newline)) something >
2) The interpreter does not read until both an expression is present and your parentheses are balanced. This is to allow multi-line expressions, e.g.
> (define (do-thing x) (do-thing-one x) (do-thing-two x)) >
Cheers,
Evan
On 2011-03-01, at 2:20 PM, spir wrote:
Hello,
Totally new to Gambit-Scheme (and mostly new to Lisp/Scheme in general). I just installed Gambit-C, precisely for learning, and started to try the REPL. Here is an example of what I get:
======================= spir@d:~$ gsi Gambit v4.2.8
(define var 9) (display var)
9>
(define var2 10)
(define (double x) (+ x x)) (double 3)
6
(display double)
#<procedure #2 double>> (define var3 11)
=======================
- No feedback at all for 'define'. (OK)
That is correct. Some special forms (such as define and set!) and procedures (such as display and write-char) don't return anything, so nothing is printed by the REPL. Actually, their evaluation at the REPL returns the void object, but the REPL does not print anything when it gets the void object.
- New prompt not separated from output of previous command.
That's because you used "display", which does not output a newline. You'd get the same behaviour with "write" and "print". You could use "println" which adds a newline, or better yet, use "pp" which will pretty print the output and is shorter to type:
(define (double x) (+ x x)) (pp 9)
9
(pp double)
(lambda (x) (+ x x))
- Key-presses of <enter> do not generate new prompt.
That's the traditional behaviour of Scheme REPLs. I tried Bigloo, Chicken, MzScheme, MIT-Scheme and Scheme48, and only Scheme48 displays a new prompt when an empty line is entered. I'm not sure what is the "best" thing to do in such a case, but at least it is intended.
Marc
On 03/01/2011 08:39 PM, Marc Feeley wrote:
On 2011-03-01, at 2:20 PM, spir wrote:
Hello,
Totally new to Gambit-Scheme (and mostly new to Lisp/Scheme in general). I just installed Gambit-C, precisely for learning, and started to try the REPL. Here is an example of what I get:
======================= spir@d:~$ gsi Gambit v4.2.8
(define var 9) (display var)
9>
(define var2 10)
(define (double x) (+ x x)) (double 3)
6
(display double)
#<procedure #2 double>> (define var3 11)
=======================
- No feedback at all for 'define'. (OK)
That is correct. Some special forms (such as define and set!) and procedures (such as display and write-char) don't return anything, so nothing is printed by the REPL. Actually, their evaluation at the REPL returns the void object, but the REPL does not print anything when it gets the void object.
- New prompt not separated from output of previous command.
That's because you used "display", which does not output a newline. You'd get the same behaviour with "write" and "print". You could use "println" which adds a newline, or better yet, use "pp" which will pretty print the output and is shorter to type:
(define (double x) (+ x x)) (pp 9)
9
(pp double)
(lambda (x) (+ x x))
- Key-presses of<enter> do not generate new prompt.
That's the traditional behaviour of Scheme REPLs. I tried Bigloo, Chicken, MzScheme, MIT-Scheme and Scheme48, and only Scheme48 displays a new prompt when an empty line is entered. I'm not sure what is the "best" thing to do in such a case, but at least it is intended.
Right, Thank you Jay, Evan, Marc; all is clear now :-)
Denis