In this line, you're calling multBins
with (cons 0 x)
and (rest y)
, and getting some result r
, and then trying to call r
:
((= (first y) 0) ((multBins (cons 0 x) (rest y))))
; ^ ^
; +--- function application -----+
The same kind of thing is happening in the next line, where you're calling addWithCarry
with some arguments, getting a result r
, and trying to call r
:
(#t ((addWithCarry x (multBins (cons 0 x) (rest y)) 0)))))
; ^ ^
; +-------------- function application -------------+
Presumable the unapplicable value '(0 0 0 1 0 1 1)
is being returned by one of these.
In a very simplified case, consider this transcript from the DrRacket REPL:
> (define (value) ; a function that returns the
'(0 0 0 1 0 1 1)) ; same value that yours should
> (value) ; calling it produces the value
(0 0 0 1 0 1 1)
> ((value)) ; calling it and then calling
; return value causes the same
; error that you're seeing
; application: not a procedure;
; expected a procedure that can be applied to arguments
; given: (0 0 0 1 0 1 1)
; arguments...: [none]
You didn't mention what editor/IDE/debugger you're using, but some should have made this a bit easier to spot. For instance, when I load your code (minus the call to test
, whose definition I don't have, and with definitions of first
and rest
), DrRacket highlights the location of the offending call:
While both of the problematic calls that I've pointed out need to be fixed, the error that you're seeing right now is occurring in the second of the two.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…