[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Create and write to a file

From: Robert Herman
Subject: [Chicken-users] Create and write to a file
Date: Sat, 3 Oct 2015 03:48:51 +0800

I've tried following the examples at 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))))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]