gpt4 book ai didi

output - SBCL 末尾的 'T' 是什么

转载 作者:太空宇宙 更新时间:2023-11-03 18:51:35 24 4
gpt4 key购买 nike

我是 SBCL 编程的新手,我运行了一个简单的加法程序:

    (defvar a)
(defvar b)
(defvar c)
(defvar d)
(write-line "Enter A:")
(setf a (read))
(write-line "Enter B:")
(setf b (read))
(format t "~D + ~D = ~D~%" a b (+ a b))

输出:

    * (load "lisp_calculator.lisp")
Enter A:
12
Enter B:
12
A + B = 24
T <--------- Whats This
*

那个“T”对我来说没有任何问题,但我只是好奇。

我正在考虑制作一个多线程程序,它将并行执行算术运算,所以我使用的是 SBCL 而不是 CLISP。我在 Kali Linux 2.0 上

最佳答案

在 Lisp 中,每个函数都会返回/计算一个值。 T这里是load的返回值,一般表示true

来自 Common Lisp the Language :

Any data object other than nil is construed to be Boolean 'not false', that is, 'true'. The symbol t is conventionally used to mean 'true' when no other value is more appropriate. When a function is said to 'return false' or to 'be false' in some circumstance, this means that it returns nil. However, when a function is said to 'return true' or to 'be true'' in some circumstance, this means that it returns some value other than nil, but not necessarily t.

关于output - SBCL 末尾的 'T' 是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43388131/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com