Nп/п : 79 из 93
 От   : none) (albert                       2:5075/128        12 сен 23 12:17:44
 К    : Tom Russ                                              12 сен 23 13:19:02
 Тема : Re: clojure / MAL confusion about true.
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
f39640fc
@REPLY:
<a83c53e8-9fff-4586-bf3e-ecbf7b148829n@googlegroups.com> 9c3926e4
@REPLYADDR none) (albert
@REPLYTO 2:5075/128 none) (albert
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<769eadf4-96c0-4632-b1c8-8117d20567c7n@googlegroups.com>
<20230911125054.179@kylheku.com> <a83c53e8-9fff-4586-bf3e-ecbf7b148829n@googlegroups.com>
@RFC-Message-ID:

@TZUTC: 0200
@TID: FIDOGATE-5.12-ge4e8b94
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 
you can have coercion and widening rules.
`if only accepts bool`s but perhaps  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 -
--- trn 4.0-test77 (Sep 1, 2010)
 * Origin: KPN B.V. (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх