The following looks like a contradiction to me:
(if (if #f #f) #t #f) ;; => #t
(equal? (if #f #f) #t) ;; => #f
Why does Scheme allowed this? And why is it anything other than division by zero?
Maciek Godek schrieb am Freitag, 10. November 2023 um 10:40:29 UTC+1:
some implementations [...] define a special value called "undefined"
in Scheme every value other than #f is considered "true"I think this is the problem. Undefined must not be a value or any function which gets passed an undefined value must throw an error.
Maybe this can be solved if the evaluation of "undefined" throws an error?
A value "undefined" can be either true or false, because it is not defined. If it behaves sometimes like true and sometimes like false, it gets spooky. It must not behave at all.
some implementations [...] define a special value called "undefined"
in Scheme every value other than #f is considered "true"
R5RS says this: |If the value of an expression is said to be ``unspecified,'' then the expression must evaluate to some object without signalling an error,
Maciek Godek schrieb am Freitag, 10. November 2023 um 12:07:22 UTC+1:
R5RS says this: |If the value of an expression is said to be ``unspecified,'' then the expression must evaluate to some object without signalling an error,
I am wondering why it has been defined this way.
I would say the opposite should be right: it must signal an error.
The following looks like a contradiction to me:
(if (if #f #f) #t #f) ;; => #t
(equal? (if #f #f) #t) ;; => #f
Why does Scheme allowed this? And why is it anything other than division by zero?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 422 |
Nodes: | 16 (0 / 16) |
Uptime: | 180:07:20 |
Calls: | 8,942 |
Calls today: | 9 |
Files: | 13,352 |
Messages: | 5,990,986 |