我在方案中編寫函數,但我得到一個「應用程序:不是一個過程; 期望可以應用於參數的過程」錯誤。我假設我沒有正確地使用條件語句:方案 - 應用程序:不是程序錯誤
(define find-allocations
(lambda (n l)
(if (null? l)
'()
(cons ((if (<=(get-property (car l) 'capacity) n)
(cons (car l) (find-allocations (- n (get-property (car l) 'capacity)) (cdr l)))
'()))
(if (<=(get-property (car l) 'capacity) n)
(cons (car l) (find-allocations (n (cdr l))))
'())))))
如果任何人都可以指出我的錯誤,將不勝感激。
[應用不是一個程序(流程地圖程序)](http://stackoverflow.com/questions/21855124/application-not-a-procedure-scheme-map-procedure) – uselpa 2014-10-29 15:24:11
的可能重複在二進制算術過程中[「應用程序:不是過程」)的可能重複(http://stackoverflow.com/questions/19022704/application-not-a-procedure-in-binary-arithmetic-procedures) – 2014-10-29 16:02:02
這不顯示了很多研究努力; Google搜索['site:stackoverflow.com「application:not a procedure」'](https://www.google.com/search?q=site%3Astackoverflow.com+%22Scheme+-+application%3A+not+ a + procedure + error%22)在堆棧溢出中出現了很多*結果,它們都是關於錯位的括號。搜索確切的錯誤消息是一個很好的練習。另外,Racket的編輯不會突出顯示問題出在哪裏,正如我鏈接到的副本所示。 – 2014-10-29 16:04:04