Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The study of non-linear physics is like the study of non-elephant biology.


devel / comp.lang.lisp / clojure / MAL confusion about true.

SubjectAuthor
* clojure / MAL confusion about true.none
`* Re: clojure / MAL confusion about true.Tom Russ
 `* Re: clojure / MAL confusion about true.Kaz Kylheku
  +* Re: clojure / MAL confusion about true.Tom Russ
  |+- Re: clojure / MAL confusion about true.none
  |`- Re: clojure / MAL confusion about true.none
  `* Re: clojure / MAL confusion about true.none
   `- Re: clojure / MAL confusion about true.George Neuner

1
clojure / MAL confusion about true.

<nnd$5af808f3$7c01957b@64cf7ef62cd56723>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Newsgroups: comp.lang.lisp
Subject: clojure / MAL confusion about true.
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$5af808f3$7c01957b@64cf7ef62cd56723>
Organization: KPN B.V.
Date: Sat, 09 Sep 2023 22:47:16 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 27
Injection-Date: Sat, 09 Sep 2023 22:47:16 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1437
 by: none - Sat, 9 Sep 2023 20:47 UTC

I'm working with MAL that is supposed to be a Clojure clone.
I'm surprised to see the following.
Almost nothing is consider false in the second position
in the `if construct, however asking for a truth value explicitly
by `true? is different. (Naively I borrowed the code for if,
routinely isolated in a separate function, and used this for `true? ).
Testing failed, thus I checked with the Clojure installed on my system.

"
Clojure 1.10.1
user=> (true? true)
true
user=> (if true? 1 2)
1
user=> (true? true?)
false
"

Is there a reason for this?

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: clojure / MAL confusion about true.

<769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
X-Received: by 2002:a05:6214:9b2:b0:649:3fe5:70b0 with SMTP id du18-20020a05621409b200b006493fe570b0mr207154qvb.11.1694455743689;
Mon, 11 Sep 2023 11:09:03 -0700 (PDT)
X-Received: by 2002:a17:902:db05:b0:1c2:c60:839d with SMTP id
m5-20020a170902db0500b001c20c60839dmr4477746plx.8.1694455742848; Mon, 11 Sep
2023 11:09:02 -0700 (PDT)
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.lisp
Date: Mon, 11 Sep 2023 11:09:02 -0700 (PDT)
In-Reply-To: <nnd$5af808f3$7c01957b@64cf7ef62cd56723>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8000:7603:1703:c1eb:b5c9:792a:2092;
posting-account=05zmAwoAAAAJZM-3jv1hCWLHGZQceqwA
NNTP-Posting-Host: 2603:8000:7603:1703:c1eb:b5c9:792a:2092
References: <nnd$5af808f3$7c01957b@64cf7ef62cd56723>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com>
Subject: Re: clojure / MAL confusion about true.
From: taruss@google.com (Tom Russ)
Injection-Date: Mon, 11 Sep 2023 18:09:03 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2476
 by: Tom Russ - Mon, 11 Sep 2023 18:09 UTC

On Saturday, September 9, 2023 at 1:47:23 PM UTC-7, none albert wrote:
> I'm working with MAL that is supposed to be a Clojure clone.
> I'm surprised to see the following.
> Almost nothing is consider false in the second position
> in the `if construct, however asking for a truth value explicitly
> by `true? is different. (Naively I borrowed the code for if,
> routinely isolated in a separate function, and used this for `true? ).
> Testing failed, thus I checked with the Clojure installed on my system.
>
> "
> Clojure 1.10.1
> user=> (true? true)
> true
> user=> (if true? 1 2)
> 1
> user=> (true? true?)
> false
> "
>
> Is there a reason for this?

(a) That is the way Clojure defines the IF operator. Only FALSE or NIL are false.
(b) That is traditionally the way Lisp defined the IF operator. Only NIL was false.

TRUE? is a function, so as an object it will not be considered equal to
the value TRUE. So asking if the function TRUE? is the value TRUE
will return false. https://clojuredocs.org/clojure.core/true_q

Now, the IF statement works differently. It will treat any value except FALSE
or NIL as being true. https://clojuredocs.org/clojure.core/if

Re: clojure / MAL confusion about true.

<20230911125054.179@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: clojure / MAL confusion about true.
Date: Mon, 11 Sep 2023 19:51:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <20230911125054.179@kylheku.com>
References: <nnd$5af808f3$7c01957b@64cf7ef62cd56723>
<769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com>
Injection-Date: Mon, 11 Sep 2023 19:51:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6a2d7add99c0dd7f4a95f93722b49487";
logging-data="1251946"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hcdIz1w0a1h8RGw0PdT8nCxL+odbxrDw="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:CsKq4pqgyvCWTEcWxWXlKvlAHjc=
 by: Kaz Kylheku - Mon, 11 Sep 2023 19:51 UTC

On 2023-09-11, Tom Russ <taruss@google.com> wrote:
> Now, the IF statement works differently. It will treat any value except FALSE
> or NIL as being true. https://clojuredocs.org/clojure.core/if

That looks like a giant clusterfuck.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: clojure / MAL confusion about true.

<a83c53e8-9fff-4586-bf3e-ecbf7b148829n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
X-Received: by 2002:a05:622a:12:b0:401:dfc4:6f8f with SMTP id x18-20020a05622a001200b00401dfc46f8fmr245730qtw.13.1694470761818;
Mon, 11 Sep 2023 15:19:21 -0700 (PDT)
X-Received: by 2002:a05:620a:4907:b0:76d:a121:4410 with SMTP id
ed7-20020a05620a490700b0076da1214410mr245719qkb.3.1694470761407; Mon, 11 Sep
2023 15:19:21 -0700 (PDT)
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.lisp
Date: Mon, 11 Sep 2023 15:19:21 -0700 (PDT)
In-Reply-To: <20230911125054.179@kylheku.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8000:7603:1703:8cca:dd09:b8f5:2235;
posting-account=05zmAwoAAAAJZM-3jv1hCWLHGZQceqwA
NNTP-Posting-Host: 2603:8000:7603:1703:8cca:dd09:b8f5:2235
References: <nnd$5af808f3$7c01957b@64cf7ef62cd56723> <769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com>
<20230911125054.179@kylheku.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a83c53e8-9fff-4586-bf3e-ecbf7b148829n@googlegroups.com>
Subject: Re: clojure / MAL confusion about true.
From: taruss@google.com (Tom Russ)
Injection-Date: Mon, 11 Sep 2023 22:19:21 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2368
 by: Tom Russ - Mon, 11 Sep 2023 22:19 UTC

On Monday, September 11, 2023 at 12:51:51 PM UTC-7, Kaz Kylheku wrote:
> On 2023-09-11, Tom Russ <tar...@google.com> wrote:
> > Now, the IF statement works differently. It will treat any value except FALSE
> > or NIL as being true. https://clojuredocs.org/clojure.core/if
> That looks like a giant clusterfuck.

It is in keeping with how Lisp traditionally defined "generalized booleans", and how
it is specified in the CommonLisp spec. Scheme is similar in treating anything other
then #f as being a true value. Similar logic can be found in many other languages like
the C-family (although zero counts as false as well there).

This is clearly not as type-safe as allowing only true Boolean values (t/nil; #t/#f, true/false)
to be used on conditionals, but it is not an uncommon design choice. It would be
cleaner in semantics to make the test more explicit about the condition, but there is
a legacy of languages often allowing various shortcuts in accepting a wider range
of values in places where boolean are semantically desired.

Re: clojure / MAL confusion about true.

<nnd$2628c371$06456fa1@bc481b001e53ece8>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Newsgroups: comp.lang.lisp
References: <nnd$5af808f3$7c01957b@64cf7ef62cd56723> <769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com> <20230911125054.179@kylheku.com> <a83c53e8-9fff-4586-bf3e-ecbf7b148829n@googlegroups.com>
Subject: Re: clojure / MAL confusion about true.
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$2628c371$06456fa1@bc481b001e53ece8>
Organization: KPN B.V.
Date: Tue, 12 Sep 2023 12:02:46 +0200
Path: i2pn2.org!i2pn.org!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 40
Injection-Date: Tue, 12 Sep 2023 12:02:46 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2567
 by: none - Tue, 12 Sep 2023 10:02 UTC

In article <a83c53e8-9fff-4586-bf3e-ecbf7b148829n@googlegroups.com>,
Tom Russ <taruss@google.com> wrote:
>On Monday, September 11, 2023 at 12:51:51 PM UTC-7, Kaz Kylheku wrote:
>> On 2023-09-11, Tom Russ <tar...@google.com> wrote:
>> > Now, the IF statement works differently. It will treat any value
>except FALSE
>> > or NIL as being true. https://clojuredocs.org/clojure.core/if
>> That looks like a giant clusterfuck.
>
>It is in keeping with how Lisp traditionally defined "generalized
>booleans", and how
>it is specified in the CommonLisp spec. Scheme is similar in treating
>anything other
>then #f as being a true value. Similar logic can be found in many other
>languages like
>the C-family (although zero counts as false as well there).
>
>This is clearly not as type-safe as allowing only true Boolean values
>(t/nil; #t/#f, true/false)
>to be used on conditionals, but it is not an uncommon design choice. It would be
>cleaner in semantics to make the test more explicit about the condition,
>but there is
>a legacy of languages often allowing various shortcuts in accepting a
>wider range
>of values in places where boolean are semantically desired.

Belatedly, I can relate to this. In Forth only if the condition is 0, the
if-action is suppressed. OTOH by convention, if a word returns a
boolean flag than the only values allowed are
be all bits 0, or all bits 1 (proper formed flag).

As you all know, Forth is not the cleanest language, so no scruples.

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: clojure / MAL confusion about true.

<nnd$50844c0f$336c8a17@17e3374091f2d548>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Newsgroups: comp.lang.lisp
Subject: Re: clojure / MAL confusion about true.
References: <nnd$5af808f3$7c01957b@64cf7ef62cd56723> <769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com> <20230911125054.179@kylheku.com>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$50844c0f$336c8a17@17e3374091f2d548>
Organization: KPN B.V.
Date: Tue, 12 Sep 2023 12:09:33 +0200
Path: i2pn2.org!i2pn.org!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 19
Injection-Date: Tue, 12 Sep 2023 12:09:33 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1402
 by: none - Tue, 12 Sep 2023 10:09 UTC

In article <20230911125054.179@kylheku.com>,
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>On 2023-09-11, Tom Russ <taruss@google.com> wrote:
>> Now, the IF statement works differently. It will treat any value except FALSE
>> or NIL as being true. https://clojuredocs.org/clojure.core/if
>
>That looks like a giant clusterfuck.

What is a 'clusterfuck'? What do you mean by this?

Kaz

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: clojure / MAL confusion about true.

<nnd$2e1eb921$2bc03b7c@c651a9b0365d7607>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Newsgroups: comp.lang.lisp
References: <nnd$5af808f3$7c01957b@64cf7ef62cd56723> <769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com> <20230911125054.179@kylheku.com> <a83c53e8-9fff-4586-bf3e-ecbf7b148829n@googlegroups.com>
Subject: Re: clojure / MAL confusion about true.
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$2e1eb921$2bc03b7c@c651a9b0365d7607>
Organization: KPN B.V.
Date: Tue, 12 Sep 2023 12:17:44 +0200
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 52
Injection-Date: Tue, 12 Sep 2023 12:17:44 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2873
 by: none - Tue, 12 Sep 2023 10:17 UTC

In article <a83c53e8-9fff-4586-bf3e-ecbf7b148829n@googlegroups.com>,
Tom Russ <taruss@google.com> wrote:
>On Monday, September 11, 2023 at 12:51:51 PM UTC-7, Kaz Kylheku wrote:
>> On 2023-09-11, Tom Russ <tar...@google.com> wrote:
>> > Now, the IF statement works differently. It will treat any value
>except FALSE
>> > or NIL as being true. https://clojuredocs.org/clojure.core/if
>> That looks like a giant clusterfuck.
>
>It is in keeping with how Lisp traditionally defined "generalized
>booleans", and how
>it is specified in the CommonLisp spec. Scheme is similar in treating
>anything other
>then #f as being a true value. Similar logic can be found in many other
>languages like
>the C-family (although zero counts as false as well there).
>
>This is clearly not as type-safe as allowing only true Boolean values
>(t/nil; #t/#f, true/false)
>to be used on conditionals, but it is not an uncommon design choice. It would be
>cleaner in semantics to make the test more explicit about the condition,
>but there is
>a legacy of languages often allowing various shortcuts in accepting a
>wider range
>of values in places where boolean are semantically desired.

Algol68 comes to mind.
real f; int i;
f := i;

f denotes a memory location where a float can be stored.
I denotes a memory location where a int can be stored.
Regards f := i.
Clearly you cannot store a memory location to a f.
Dereferencing: an int.
Clearly you cannot store an int to a f.
Widening and int to an f.

Now in the situation
if <expression>
you can have coercion and widening rules.
`if only accepts bool's but perhaps <expression> can be forced into
the mold "bool" .
This as rigorous as it gets.

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: clojure / MAL confusion about true.

<1ov1gitjdbg5fipmb8gvto6ag3ft8lhpg6@4ax.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: gneuner2@comcast.net (George Neuner)
Newsgroups: comp.lang.lisp
Subject: Re: clojure / MAL confusion about true.
Date: Tue, 12 Sep 2023 20:15:46 -0400
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <1ov1gitjdbg5fipmb8gvto6ag3ft8lhpg6@4ax.com>
References: <nnd$5af808f3$7c01957b@64cf7ef62cd56723> <769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com> <20230911125054.179@kylheku.com> <nnd$50844c0f$336c8a17@17e3374091f2d548>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="e94a7cd3746cc01cc182236d9d9df83d";
logging-data="1895255"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18cQkbSyHNVU+sPV0PxB8PMlQYCvRJN5UQ="
User-Agent: ForteAgent/8.00.32.1272
Cancel-Lock: sha1:Er2MsouzSgH3Eg5l436ItJzRGJM=
 by: George Neuner - Wed, 13 Sep 2023 00:15 UTC

On Tue, 12 Sep 2023 12:09:33 +0200, albert@cherry.(none) (albert)
wrote:

>In article <20230911125054.179@kylheku.com>,
>Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>>On 2023-09-11, Tom Russ <taruss@google.com> wrote:
>>
>>> Now, the IF statement works differently. It will treat any value except FALSE
>>> or NIL as being true. https://clojuredocs.org/clojure.core/if
>>
>>That looks like a giant clusterfuck.
>
>What is a 'clusterfuck'? What do you mean by this?

https://www.merriam-webster.com/dictionary/clusterfuck

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor