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

DEFUN SIGN-OF is beyond repair #110

Closed
phoe opened this issue May 6, 2020 · 0 comments · Fixed by #111
Closed

DEFUN SIGN-OF is beyond repair #110

phoe opened this issue May 6, 2020 · 0 comments · Fixed by #111

Comments

@phoe
Copy link
Contributor

phoe commented May 6, 2020

; returns sign x
(defun sign-of (x)
  (if (< x 0) (return-from sign-of -1))
  (if (eq x 0) (return-from sign-of 0))
  1)
  1. (sign-of 0.0) ;=> 1, not 0
  2. it uses eq on a number, which has undefined result
  3. it uses multiple return-froms instead of a cond or a typecase
  4. cl:signum exists

Will fix this in my fork and submit a PR along with all other koan fixes.

@phoe phoe mentioned this issue May 9, 2020
1 task
@Slids Slids closed this as completed in #111 May 9, 2020
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

Successfully merging a pull request may close this issue.

1 participant