【问题标题】:Integer division in Common LispCommon Lisp 中的整数除法
【发布时间】:2017-11-08 21:22:05
【问题描述】:

我尝试在 Lisp 中进行除法运算。 当我做(/ 5 2)时,结果是5/2, 但我需要的是2

我该怎么做?

【问题讨论】:

    标签: common-lisp integer-division


    【解决方案1】:

    函数调用

    (floor 5 2)
    

    将返回整数除法 2 和余数 1 的结果。

    Common Lisp Hyperspec 中的Description

    【讨论】:

    • 我需要将结果存储在一个变量中,它可以工作,谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-18
    • 1970-01-01
    相关资源
    最近更新 更多