Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print done
#1
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
Reply
#2
(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).
UA ACM Vice President
ACM has bi-weekly meetings Tuesdays at 5:15pm
We're UA's best organization for CS majors (website)
Join us on Slack for all kinds of discussion channels (including one for CS403)
Reply
#3
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
Reply
#4
(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.
UA ACM Vice President
ACM has bi-weekly meetings Tuesdays at 5:15pm
We're UA's best organization for CS majors (website)
Join us on Slack for all kinds of discussion channels (including one for CS403)
Reply
#5
Don't do any error checking unless the task description tells you to do so.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)