简体   繁体   English

未定义函数 A 有什么问题? (口齿不清)

[英]What is wrong with Undefined function A? (lisp)

Have to write a program that asks the user for input until they input 0. Then must output the minimum value for number that were inputted.必须编写一个程序,要求用户输入直到他们输入 0。然后必须输出输入的数字的最小值。 I am new to lisp and i keep getting undefined function A in the console but a is a variable in the code.我是 lisp 的新手,我一直在控制台中收到未定义的函数 A,但 a 是代码中的一个变量。

(defun find_min ( x y )
  (if(< x y)
     (+ x 0)
     (+ y 0)))

(defun minOfNums()
  (loop 
     (princ "Enter number: ")
     (setq a (read))        
     (princ "Enter number: ")
     (setq min (find_min (a (read))))
     (terpri)
     (when (= a 0) (return a)))
  (write min))

(minOfNums) (minOfNums)

In (setq min (find_min (a (read)))) you are calling the function a with the result of reading an object from the user.(setq min (find_min (a (read))))您正在调用函数a ,其结果是从用户那里读取对象。 It should (probably) be (setq min (find_min a (read))) instead.它应该(可能)是(setq min (find_min a (read)))代替。

If nothing else, the find_min function expects two arguments and the code as written only passes one.如果不出find_minfind_min函数需要两个参数,而编写的代码只传递一个参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM