I've tried following the examples at
http://wiki.call-cc.org/language-comparison to see how to open and write to
files, but I am failing. I have modified an existing CHICKEN scheme program
that calculates digits of Pi using the Chudnovsky algorithm. I removed the
last timing bit part, and put in a read prompt for the user to input a
number of digits desired, and then display the output in the console.
However, I'd like to write it to a file too. I tried creating a file from
scratch and putting in an empty file in the directory already. I also tried
(open-input-file path) before this as well.
Here's what I have so far that throws a 'lambda-list expected' error. NOTE:
I tried a format without the lambda part as well:

...
(display "How many digits of Pi to compute?\n ")
(define digits (read))

(display "Here you go: \n")
(format #t (number->string (pich digits)))

(define (write-to-a-file
"c:/users/robert/desktop/Chicken-IPU-Examples/pidigits.txt" (lambda ()
(format #t "~A~%" (number->string(pigud num))))))
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to