Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I have a very small mind and must live with it. -- E. Dijkstra


devel / comp.lang.scheme / Re: Why is it allowed to deduce from undefined?

SubjectAuthor
* Why is it allowed to deduce from undefined?ceving
+* Re: Why is it allowed to deduce from undefined?Maciek Godek
|`* Re: Why is it allowed to deduce from undefined?ceving
| `* Re: Why is it allowed to deduce from undefined?Maciek Godek
|  `* Re: Why is it allowed to deduce from undefined?ceving
|   `- Re: Why is it allowed to deduce from undefined?Tristan Wibberley
`- Re: Why is it allowed to deduce from undefined?Tristan Wibberley

1
Why is it allowed to deduce from undefined?

<33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=248&group=comp.lang.scheme#248

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:ad4:5388:0:b0:66d:783:ee02 with SMTP id i8-20020ad45388000000b0066d0783ee02mr191381qvv.13.1699604502296;
Fri, 10 Nov 2023 00:21:42 -0800 (PST)
X-Received: by 2002:a63:c07:0:b0:5bd:d79a:b3c0 with SMTP id
b7-20020a630c07000000b005bdd79ab3c0mr994914pgl.0.1699604501961; Fri, 10 Nov
2023 00:21:41 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Fri, 10 Nov 2023 00:21:41 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=80.146.200.110; posting-account=lpIdjwoAAACRkyYbzslDBEV0EPSPAHhN
NNTP-Posting-Host: 80.146.200.110
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>
Subject: Why is it allowed to deduce from undefined?
From: ceving@gmail.com (ceving)
Injection-Date: Fri, 10 Nov 2023 08:21:42 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1178
 by: ceving - Fri, 10 Nov 2023 08:21 UTC

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?

Re: Why is it allowed to deduce from undefined?

<1ecee9d2-0928-480e-88e1-c99300e89ad2n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=249&group=comp.lang.scheme#249

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:a05:6214:20c:b0:66c:faff:e9a2 with SMTP id i12-20020a056214020c00b0066cfaffe9a2mr180663qvt.5.1699609227672;
Fri, 10 Nov 2023 01:40:27 -0800 (PST)
X-Received: by 2002:a0c:bf0b:0:b0:66c:fbe5:18ab with SMTP id
m11-20020a0cbf0b000000b0066cfbe518abmr61863qvi.4.1699609227440; Fri, 10 Nov
2023 01:40:27 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Fri, 10 Nov 2023 01:40:27 -0800 (PST)
In-Reply-To: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.192.91.3; posting-account=f7iIKQoAAAAkDKpUafc-4IXhmRAzdB5r
NNTP-Posting-Host: 213.192.91.3
References: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1ecee9d2-0928-480e-88e1-c99300e89ad2n@googlegroups.com>
Subject: Re: Why is it allowed to deduce from undefined?
From: godek.maciek@gmail.com (Maciek Godek)
Injection-Date: Fri, 10 Nov 2023 09:40:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 43
 by: Maciek Godek - Fri, 10 Nov 2023 09:40 UTC

piątek, 10 listopada 2023 o 09:21:43 UTC+1 ceving napisał(a):
> 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?

I don't think this behaviour would be consistent across the implementations,
(and I don't think it's well-defined)

The reason this might work on some implementations is that they define
a special value called "undefined", which is "silent" when it's supposed to be displayed in the REPL.
(I know that Guile does that)

It can also be occasionally true that (eq? (if #f #f) (if #f #f)).

Of course, this value isn't equal to #t, which is why the second equality is #f.
But this isn't any more surprising than, say

(if 5 #t #f) ;; => #t
(equal? 5 #t) ;; => #f

because in Scheme every value other than #f is considered "true" in the context of "if"
(and since this special "unspecified" value is different from #f, it is also considered "true")

BTW When it comes to "division by zero", then it is also an ambiguous phrase:

(/ 2 0) ===>!error
(/ 2.0 0) ===> +inf.0
(/ 0.0 0) ===> +nan.0
(/ -2.0 0) ===> -inf.0
(/ 2 0.0) ===> +inf.0
(/ 2 -0.0) ===> -inf.0
(/ 2.0 -0) ===> +inf.0

Re: Why is it allowed to deduce from undefined?

<7d8de17d-7b98-4793-81f0-bbd0b63486c5n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=250&group=comp.lang.scheme#250

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:a05:6214:1387:b0:677:9190:13d6 with SMTP id pp7-20020a056214138700b00677919013d6mr125588qvb.2.1699611450317;
Fri, 10 Nov 2023 02:17:30 -0800 (PST)
X-Received: by 2002:a05:620a:8795:b0:776:f5ad:a7de with SMTP id
py21-20020a05620a879500b00776f5ada7demr168741qkn.1.1699611450109; Fri, 10 Nov
2023 02:17:30 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Fri, 10 Nov 2023 02:17:29 -0800 (PST)
In-Reply-To: <1ecee9d2-0928-480e-88e1-c99300e89ad2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.146.200.110; posting-account=lpIdjwoAAACRkyYbzslDBEV0EPSPAHhN
NNTP-Posting-Host: 80.146.200.110
References: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com> <1ecee9d2-0928-480e-88e1-c99300e89ad2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7d8de17d-7b98-4793-81f0-bbd0b63486c5n@googlegroups.com>
Subject: Re: Why is it allowed to deduce from undefined?
From: ceving@gmail.com (ceving)
Injection-Date: Fri, 10 Nov 2023 10:17:30 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1794
 by: ceving - Fri, 10 Nov 2023 10:17 UTC

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.

Re: Why is it allowed to deduce from undefined?

<7a54f16a-9839-4530-9242-1ed9f6632d01n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=251&group=comp.lang.scheme#251

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:a05:620a:2901:b0:778:9217:c79 with SMTP id m1-20020a05620a290100b0077892170c79mr229142qkp.8.1699614440364;
Fri, 10 Nov 2023 03:07:20 -0800 (PST)
X-Received: by 2002:a17:903:451:b0:1cc:2a1d:fb1a with SMTP id
iw17-20020a170903045100b001cc2a1dfb1amr1100572plb.4.1699614440059; Fri, 10
Nov 2023 03:07:20 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Fri, 10 Nov 2023 03:07:19 -0800 (PST)
In-Reply-To: <7d8de17d-7b98-4793-81f0-bbd0b63486c5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.192.91.3; posting-account=f7iIKQoAAAAkDKpUafc-4IXhmRAzdB5r
NNTP-Posting-Host: 213.192.91.3
References: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>
<1ecee9d2-0928-480e-88e1-c99300e89ad2n@googlegroups.com> <7d8de17d-7b98-4793-81f0-bbd0b63486c5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7a54f16a-9839-4530-9242-1ed9f6632d01n@googlegroups.com>
Subject: Re: Why is it allowed to deduce from undefined?
From: godek.maciek@gmail.com (Maciek Godek)
Injection-Date: Fri, 10 Nov 2023 11:07:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3075
 by: Maciek Godek - Fri, 10 Nov 2023 11:07 UTC

piątek, 10 listopada 2023 o 11:17:32 UTC+1 ceving napisał(a):
> 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.

I don't think it's mentioned anywhere in any RnRS.

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, but the value depends on the implementation; this report explicitly does not say what value should be returned."

> Maybe this can be solved if the evaluation of "undefined" throws an error?

Some implementations that I tested produce a warning or an error when you're trying to use a one-armed if in the context that requires a value to be produced.

> 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.

I haven't ever seen it behaving as #f anywhere. And indeed, the standard says:
"Of all the standard Scheme values, only #f counts as false in conditional expressions"
so if this value is distinct from #f, it cannot behave as #f.

(I know that Kawa makes a deviation there, and allows another value to be false in the context of "if",
namely the #!null value - which makes sense given its JVM interop, and which I personally found convenient,
although I realize that different people's opinions on that matter will vary)

Re: Why is it allowed to deduce from undefined?

<05df6561-f04b-4845-b472-8adb4a7e4694n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=252&group=comp.lang.scheme#252

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:a05:620a:19a0:b0:76f:109e:e244 with SMTP id bm32-20020a05620a19a000b0076f109ee244mr212489qkb.5.1699615980817;
Fri, 10 Nov 2023 03:33:00 -0800 (PST)
X-Received: by 2002:a05:620a:2ac4:b0:773:f669:bc27 with SMTP id
bn4-20020a05620a2ac400b00773f669bc27mr176398qkb.4.1699615980576; Fri, 10 Nov
2023 03:33:00 -0800 (PST)
Path: i2pn2.org!i2pn.org!nntp.comgw.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Fri, 10 Nov 2023 03:33:00 -0800 (PST)
In-Reply-To: <7a54f16a-9839-4530-9242-1ed9f6632d01n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.146.200.110; posting-account=lpIdjwoAAACRkyYbzslDBEV0EPSPAHhN
NNTP-Posting-Host: 80.146.200.110
References: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>
<1ecee9d2-0928-480e-88e1-c99300e89ad2n@googlegroups.com> <7d8de17d-7b98-4793-81f0-bbd0b63486c5n@googlegroups.com>
<7a54f16a-9839-4530-9242-1ed9f6632d01n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <05df6561-f04b-4845-b472-8adb4a7e4694n@googlegroups.com>
Subject: Re: Why is it allowed to deduce from undefined?
From: ceving@gmail.com (ceving)
Injection-Date: Fri, 10 Nov 2023 11:33:00 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1664
 by: ceving - Fri, 10 Nov 2023 11:33 UTC

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.

Re: Why is it allowed to deduce from undefined?

<urv5bv$1s7n9$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=324&group=comp.lang.scheme#324

  copy link   Newsgroups: comp.lang.scheme
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tristan.wibberley+netnews2@alumni.manchester.ac.uk (Tristan Wibberley)
Newsgroups: comp.lang.scheme
Subject: Re: Why is it allowed to deduce from undefined?
Date: Sat, 2 Mar 2024 12:17:02 +0000
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <urv5bv$1s7n9$1@dont-email.me>
References: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 2 Mar 2024 12:17:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f35d0a1a33e0186eb06251e729bef78d";
logging-data="1973993"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gG5aKpCE08Qv7KyDt8glFvZRYiyT/kaNR0Y4lLPWJQw=="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:vOHACOLXAP6zM4kxqmGU1hHdBd8=
In-Reply-To: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>
Content-Language: en-GB
 by: Tristan Wibberley - Sat, 2 Mar 2024 12:17 UTC

On 10/11/2023 08:21, ceving wrote:
> 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?

In Guile:
*There seems to be a common object available with the name
"*unspecified*" which 'if' uses for an unspecified branch.

* It's 'equal?' to itself as well as 'eq?' and 'eqv?' - I didn't try
others.

* It's distinct from both end-of-list and #f.

I would expect division by zero only should 'if' be defined at least in
part by division.

--
Tristan

Re: Why is it allowed to deduce from undefined?

<urv7ed$1sl8m$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=325&group=comp.lang.scheme#325

  copy link   Newsgroups: comp.lang.scheme
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tristan.wibberley+netnews2@alumni.manchester.ac.uk (Tristan Wibberley)
Newsgroups: comp.lang.scheme
Subject: Re: Why is it allowed to deduce from undefined?
Date: Sat, 2 Mar 2024 12:52:27 +0000
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <urv7ed$1sl8m$1@dont-email.me>
References: <33039de8-5db0-4c06-b764-39a7a7e475a2n@googlegroups.com>
<1ecee9d2-0928-480e-88e1-c99300e89ad2n@googlegroups.com>
<7d8de17d-7b98-4793-81f0-bbd0b63486c5n@googlegroups.com>
<7a54f16a-9839-4530-9242-1ed9f6632d01n@googlegroups.com>
<05df6561-f04b-4845-b472-8adb4a7e4694n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 2 Mar 2024 12:52:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f35d0a1a33e0186eb06251e729bef78d";
logging-data="1987862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nHpT05Ewz2pdJmj7egtAE5n5xQVB308rKhaO9H8DzUQ=="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:71xMU/44aUQdRnwPaWeK866jA3M=
Content-Language: en-GB
In-Reply-To: <05df6561-f04b-4845-b472-8adb4a7e4694n@googlegroups.com>
 by: Tristan Wibberley - Sat, 2 Mar 2024 12:52 UTC

On 10/11/2023 11:33, ceving wrote:
> 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.

First, I'm a newbie with Scheme, so I don't know all the names and nuances.

You're thinking of pure functional languages. In Scheme, which has a
certain imperative essence, (if...) can give *unspecified* and you can
signal an error in that condition. It's like 'Control.Monad.when' in
Haskell or 'if' in C, except that it also allows you to use it like 'if'
in Haskell if you want to.

That makes (if...) useful for inserting conditional actions in a
sequence of them.

You can always give a second argument if you are slow and steady enough.

You can write a strict (if...) that requires two arguments but you must
use a macro, I think, rather than (define...). I think you can force all
(if...) uses in your files to be so strict if you want to make sure
you've done that everywhere but I'm not so sure scheme makes it hard to
subsequently liberalise.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor