“application: not a procedure” while computing binomial

后端 未结 3 531
别跟我提以往
别跟我提以往 2021-01-26 15:09

I am defining a function binomial(n k) (aka Pascal\'s triangle) but am getting an error:

    application: not a procedure;
    expected a procedure          


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-26 15:58

    Your error is here:

    binomial(n)
    

    n is an integer, not a function. If you put parentheses around it like that, scheme tries to invoke an integer as a function, which naturally produces an error.

提交回复
热议问题