The Beastie Forums

Full Version: Print done
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I believe this was discussed in the class....

How to take out the print done.
Use (pushback ch) ?


For task 1, if user enters an invalid entry, I get the output , however it also prints the print done statement. I want to take out the print done statement.

mmrahman1@Ruby:~/cs403/assign1$ echo "(0 0 0)" > task1.args
mmrahman1@Ruby:~/cs403/assign1$ scam -r task1.scm task1.args
Invalid entry to calculate cost
print-done
(09-07-2017, 04:15 AM)mmrahman Wrote: [ -> ]I believe this was discussed in the class....

How to take out the print done.
Use (pushback ch) ?


For task 1, if user enters an invalid entry, I get the output , however it also prints the print done statement. I want to take out the print done statement.

mmrahman1@Ruby:~/cs403/assign1$ echo "(0 0 0)" > task1.args
mmrahman1@Ruby:~/cs403/assign1$ scam -r task1.scm task1.args
Invalid entry to calculate cost
print-done

Are you calling println on the function that prints "Invalid entry to calculate cost"? If so, it's just printing the return value of that function (which was the printing of that error message).
Thank you Davidmccoy, is there anything can be done so that printdone is not visible? In another task a statement like that skewing my result, so I took it out to finish the task. Yes I have used println
(09-07-2017, 04:50 AM)mmrahman Wrote: [ -> ]Thank you Davidmccoy, is there anything can be done so that printdone is not visible? In another task a statement like that skewing my result, so I took it out to finish the task. Yes I have used println

You don't really need to print error messages for these assignments. I'd move on to the next task.

Also, I'm vain. Plz use the Rate button to let me know I'm valuable.

For the purposes of explanation, if a function f is defined as

Code:
(define (f) (println "Hey-o!"))


And then in a function named 'main' one typed this:

Code:
(define (main) (println f))


Then you would get as output (running with the -r option):

Code:
Hey-o!
print-done


You could just do

Code:
(define (main) (f))


And then it would just print

Code:
"Hey-o!"


But you obviously are trying to print a numerical value returning from f in main. So you have a conflict of interest.
Don't do any error checking unless the task description tells you to do so.