Problem 223 Introducing Scheme

Back to General discussions forum

JesseDai     2022-10-01 20:58:18
User avatar

Hello people who have solved problem 223,

Testing my multiplex function on the scheme interpreter yielded the correct answer in what seems to be the correct format, but the checker says that the output doesn't end with a single-digit value.

Do I need to account for negative numbers?

Is there something wrong with how output is displayed?

Any feedback is appreciated.

thanks,

Jesse

gardengnome     2022-10-02 05:50:22
User avatar

Hi.

Your code produces 1937 189 72 14 4 for the example in the problem, but somehow 1937 189 72 14 4#t is required. I never fully understood the finer nuances of this ... maybe somebody with LISP background can explain.

JesseDai     2022-10-02 06:29:43
User avatar

Wow, I never expected that. I just now added (= 1 1) at the end and the answer was accepted. Thank you for the help!

How did you figure out #t was needed?

Rodion (admin)     2022-10-02 06:34:56
User avatar

Hm-m-m, it is not much about lisp, probably... this more looks like something may need to be fixed on interpreter or checker side, I feel a bit confused, sorry.

Jesse, could you please provide the exact version of your function which causes the trouble?

gardengnome     2022-10-02 06:38:28
User avatar

Could it be that this relates to only displaying things in a function but not actually returning anything? The (= 1 1) adds a return value.

JesseDai     2022-10-02 06:44:00
User avatar

Sure Rodion, a copy can be found in my unsuccessful solutions list under Lisp.

Rodion (admin)     2022-10-02 07:16:16
User avatar

Thanks for clarification - and thanks for reporting this! Definitely some queer bug - as I see the interpreter used by the site doesn't print the last number, unlike the javascript version.

I'm much sorry, but also much glad you reported this!

Shall look further into it some time later - going to skate with my dog now to fetch my wife's yoga magic carpet from the closing yoga studio - oh that Sunday morning :)))

Rodion (admin)     2022-10-03 06:49:07
User avatar

Well, sorry for it took time. Culprit was this small line in your code

(else display t)

where you probably meant

(else (display t))

I'm not yet 100% clearly understanding how exactly it confused us, but seemingly your code printed all values except the last, while the last value in online emulator was added as a result returned from function.

Clearly this is unlucky representation issue. And also it become clear to me that it would be better to provide a way to run the code against server scheme executor to cross-verify it. I'll work on it.

JesseDai     2022-11-18 01:43:37
User avatar

Oh my God I just saw your reply Rodion. Sorry for not replying all this time! It seems like I was ignoring you...

Thank you for discovering the issue. I will change it now. :)

Rodion (admin)     2022-11-18 17:45:38
User avatar

It seems like I was ignoring you

ha-ha, no, no worry - it more seems like we are lacking notifications on new forum answers... I really, really hope to add them, hopefully, in not very far future...

Please login and solve 5 problems to be able to post at forum