If I procedure, example:
(define square
(lambda (n)
(* n n)))
and I test it using (square 5) for example, how do I pipe this result from the Gambit Scheme interpreter to a text file?
If I procedure, example:
(define square
(lambda (n)
(* n n)))
and I test it using (square 5) for example, how do I pipe this result from the Gambit Scheme interpreter to a text file?
One solution:
(define square
(lambda (n)
(* n n)))
(call-with-output-file "a-file.txt"
(lambda ()
(display (square 5))
(newline)))
Another is to print directly to standard output:
(define square
(lambda (n)
(* n n)))
(display (square 5))
(newline)
And then use >
in the shell to direct the output to a specific file.