Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guile solution using standard lib is failing to validate #62

Closed
4censord opened this issue Dec 24, 2024 · 5 comments
Closed

Guile solution using standard lib is failing to validate #62

4censord opened this issue Dec 24, 2024 · 5 comments

Comments

@4censord
Copy link

4censord commented Dec 24, 2024

I'm currently doing the scheme track to improve with guile.
During scheme/grains, three of the tests expect an exeption to be thrown.

Reading the documentation for guile about exepctions (https://www.gnu.org/software/guile/manual/html_node/Exception-Objects.html), has lead me to this solution:

(import (rnrs))
(use-modules (ice-9 exceptions))

(define (square n)
  (cond
    ((< 64 n) => (raise-exception
                 (make-exception-with-message 'implementation-restriction '"to high")))
    ((= 0 n) => (raise-exception
                (make-exception-with-message 'implementation-restriction '"zero is not allowed")))
    ((> 1 n) => (raise-exception
                (make-exception-with-message 'implementation-restriction '"negative is not allowed")))
    ((= 1 n) '1)
    (else (* 2 (square (- n 1))))
    ))

(define total
  (apply + (map square (iota 64 1))))

This works perfeclty fine locally, but fails in the test runner with

Failed with value: (error #f "~A ~S" "\"no code for module\"" "(ice-9 exceptions)")

So i assume that these libraries are missing on the test runner?
Is that expected?
Is there maybe some switch i need to set to get access to them?

System desctiption `Linux tuxbook 6.12.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 19 Dec 2024 21:29:01 +0000 x86_64 GNU/Linux`, on arch linux with `guile (GNU Guile) 3.0.10`
Copy link

Hello. Thanks for opening an issue on Exercism 🙂

At Exercism we use our Community Forum, not GitHub issues, as the primary place for discussion. That allows maintainers and contributors from across Exercism's ecosystem to discuss your problems/ideas/suggestions without them having to subscribe to hundreds of repositories.

This issue will be automatically closed. Please use this link to copy your GitHub Issue into a new topic on the forum, where we look forward to chatting with you!

If you're interested in learning more about this auto-responder, please read this blog post.

@4censord
Copy link
Author

@exercism-bot The link you provided is broken.

@4censord
Copy link
Author

@iHiD I can understand the reasoning in the blogpost, but the link your bot provided gives a 500 error, and 0 indication of how to proceed. This incredibly frustrating.

Especially, because the documentation on the website itself directed me to open an issue here:

If you would like to get involved in helping with an existing Test Runner, please open an issue in its repository asking if there is somewhere you can help.
~https://exercism.org/docs/building/tooling/test-runners

@SleeplessByte
Copy link
Member

So i assume that these libraries are missing on the test runner?
Is that expected?

Yes, by default most test-runners include no libraries or only "the most popular ones", because test-runners do not have access to the internet and thus need to be prebuild, whatever that means in the language of choice.

See: exercism/rust-test-runner#27 for some context.

For example on JavaScript and TypeScript, pulling a package from a registry in a solution is not allowed, by design.

I know that for Scheme, the import works, but the modules do not. You should not need it to solve this exercise.

Spoiler: passing solution
(import (rnrs))

(define (square n)
  (when (or (< n 1) (> n 64))
    (error 'square "out of range" n))
  (ash 1 (1- n)))

(define total
  (1- (* 2 (square 64))))

Now, if you @4censord want to advocate to support those modules, please open a topic on the forum using the provided link so it can be discussed.

[...] but the link your bot provided gives a 500 error, and 0 indication of how to proceed. [...]

The two links in the automated post don't 500 for me, it may have been a temporary issue? If the following does not work, you can go to https://forum.exercism.org instead.

https://forum.exercism.org/new-topic?title=Guile%20solution%20using%20standard%20lib%20is%20failing%20to%20validate&body=I%27m%20currently%20doing%20the%20scheme%20track%20improve%20with%20guile.%0D%0ADuring%20%5Bscheme/grains%5D(https://exercism.org/tracks/scheme/exercises/grains),%20three%20of%20the%20tests%20expect%20an%20exeption%20to%20be%20thrown.%0D%0A%0D%0AReading%20the%20documentation%20for%20guile%20about%20exepctions%20(https://www.gnu.org/software/guile/manual/html_node/Exception-Objects.html),%20has%20lead%20me%20to%20this%20solution:%0D%0A%0D%0A%60%60%60%0D%0A(import%20(rnrs))%0D%0A(use-modules%20(ice-9%20exceptions))%0D%0A%0D%0A(define%20(square%20n)%0D%0A%20%20(cond%0D%0A%20%20%20%20((%3C%2064%20n)%20=%3E%20(raise-exception%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(make-exception-with-message%20%27implementation-restriction%20%27%22to%20high%22)))%0D%0A%20%20%20%20((=%200%20n)%20=%3E%20(raise-exception%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(make-exception-with-message%20%27implementation-restriction%20%27%22zero%20is%20not%20allowed%22)))%0D%0A%20%20%20%20((%3E%201%20n)%20=%3E%20(raise-exception%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(make-exception-with-message%20%27implementation-restriction%20%27%22negative%20is%20not%20allowed%22)))%0D%0A%20%20%20%20((=%201%20n)%20%271)%0D%0A%20%20%20%20(else%20(*%202%20(square%20(-%20n%201))))%0D%0A%20%20%20%20))%0D%0A%0D%0A(define%20total%0D%0A%20%20(apply%20+%20(map%20square%20(iota%2064%201))))%0D%0A%60%60%60%0D%0AThis%20works%20perfeclty%20fine%20locally,%20but%20fails%20in%20the%20test%20runner%20with%20%0D%0A%60%60%60%0D%0AFailed%20with%20value:%20(error%20#f%20%22~A%20~S%22%20%22%5C%22no%20code%20for%20module%5C%22%22%20%22(ice-9%20exceptions)%22)%0D%0A%60%60%60%0D%0ASo%20i%20assume%20that%20these%20libraries%20are%20missing%20on%20the%20test%20runner?%0D%0AIs%20that%20expected?%0D%0AIs%20there%20maybe%20some%20switch%20i%20need%20to%20set%20to%20get%20access%20to%20them?%0D%0A%0D%0A%0D%0A%3Cdetails%3E%0D%0A%3Csummary%3ESystem%20desctiption%3C/summary%3E%0D%0A%60Linux%20tuxbook%206.12.6-arch1-1%20#1%20SMP%20PREEMPT_DYNAMIC%20Thu,%2019%20Dec%202024%2021:29:01%20+0000%20x86_64%20GNU/Linux%60,%20on%20arch%20linux%20with%20%60guile%20(GNU%20Guile)%203.0.10%60%0D%0A%3C/details%3E%0D%0A&category=scheme

@4censord
Copy link
Author

Hey, sorry for not replying I fell ill on vacation, but now i'm back and responsive again.

So i assume that these libraries are missing on the test runner?
Is that expected?

Yes, by default most test-runners include no libraries or only "the most popular ones", because test-runners do not have access to the internet and thus need to be prebuild, whatever that means in the language of choice.

Hm, my understanding was that the (ice-9) namespace is the guile standard library.
I had understood that the standard libraries are supposed to be included.
Because the thing I used is part of the guile book (https://www.gnu.org/software/guile/manual/html_node/Exception-Objects.html)

If this would have been any random library, i would not have complained.

See: exercism/rust-test-runner#27 for some context.

For example on JavaScript and TypeScript, pulling a package from a registry in a solution is not allowed, by design.
I know that for Scheme, the import works, but the modules do not. You should not need it to solve this exercise.

Now, if you @4censord want to advocate to support those modules,
please open a topic on the forum using the provided link so it can be
discussed.

[...] but the link your bot provided gives a 500 error, and 0 indication of how to proceed. [...]
The two links in the automated post don't 500 for me, it may have been a temporary issue? If the following does not work, you can go to https://forum.exercism.org instead.

https://forum.exercism.org/new-topic?title=Guile%20solution%20using%20standard%20lib%20is%20failing%20to%20validate&body=I%27m%20currently%20doing%20the%20scheme%20track%20improve%20with%20guile.%0D%0ADuring%20%5Bscheme/grains%5D(https://exercism.org/tracks/scheme/exercises/grains),%20three%20of%20the%20tests%20expect%20an%20exeption%20to%20be%20thrown.%0D%0A%0D%0AReading%20the%20documentation%20for%20guile%20about%20exepctions%20(https://www.gnu.org/software/guile/manual/html_node/Exception-Objects.html),%20has%20lead%20me%20to%20this%20solution:%0D%0A%0D%0A%60%60%60%0D%0A(import%20(rnrs))%0D%0A(use-modules%20(ice-9%20exceptions))%0D%0A%0D%0A(define%20(square%20n)%0D%0A%20%20(cond%0D%0A%20%20%20%20((%3C%2064%20n)%20=%3E%20(raise-exception%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(make-exception-with-message%20%27implementation-restriction%20%27%22to%20high%22)))%0D%0A%20%20%20%20((=%200%20n)%20=%3E%20(raise-exception%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(make-exception-with-message%20%27implementation-restriction%20%27%22zero%20is%20not%20allowed%22)))%0D%0A%20%20%20%20((%3E%201%20n)%20=%3E%20(raise-exception%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(make-exception-with-message%20%27implementation-restriction%20%27%22negative%20is%20not%20allowed%22)))%0D%0A%20%20%20%20((=%201%20n)%20%271)%0D%0A%20%20%20%20(else%20(*%202%20(square%20(-%20n%201))))%0D%0A%20%20%20%20))%0D%0A%0D%0A(define%20total%0D%0A%20%20(apply%20+%20(map%20square%20(iota%2064%201))))%0D%0A%60%60%60%0D%0AThis%20works%20perfeclty%20fine%20locally,%20but%20fails%20in%20the%20test%20runner%20with%20%0D%0A%60%60%60%0D%0AFailed%20with%20value:%20(error%20#f%20%22~A%20~S%22%20%22%5C%22no%20code%20for%20module%5C%22%22%20%22(ice-9%20exceptions)%22)%0D%0A%60%60%60%0D%0ASo%20i%20assume%20that%20these%20libraries%20are%20missing%20on%20the%20test%20runner?%0D%0AIs%20that%20expected?%0D%0AIs%20there%20maybe%20some%20switch%20i%20need%20to%20set%20to%20get%20access%20to%20them?%0D%0A%0D%0A%0D%0A%3Cdetails%3E%0D%0A%3Csummary%3ESystem%20desctiption%3C/summary%3E%0D%0A%60Linux%20tuxbook%206.12.6-arch1-1%20#1%20SMP%20PREEMPT_DYNAMIC%20Thu,%2019%20Dec%202024%2021:29:01%20+0000%20x86_64%20GNU/Linux%60,%20on%20arch%20linux%20with%20%60guile%20(GNU%20Guile)%203.0.10%60%0D%0A%3C/details%3E%0D%0A&category=scheme

This link consistently fails for me. I have no idea what i am doing wrong, it happens on different devices/browsers/networks.

rev-small.mp4

Sadly, there seems no logs on my side, and i havent found a corelation id either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants