On 2016-05-26 14:27, Efraim Flashner wrote:
Here's where I'm currently at with 'wc'. Currently I'm getting an error
about having the wrong number of arguments for lambda (I assume)
[...]
+(define (wc-command file)
+ ((lambda (lines words chars) ; lambda doesn't like 3 variables
+ (format #t "~a ~a ~a ~a~%" lines words chars file))
+ (call-with-input-file file lines+chars)))
[...]
;;; /home/efraim/workspace/guix/guix/build/bournish.scm:143:2: warning:
wrong number of arguments to `#<tree-il (lambda () (lambda-case
(((lines
words chars) #f #f #f () (lines-24244 words-24245 chars-24246)) (apply
(toplevel format) (const #t) (const "~a ~a ~a ~a~%") (lexical lines
lines-24244) (lexical words words-24245) (lexical chars chars-24246)
(lexical file file-24242)))))>'
I think you might just be missing a 'call-with-values':
(define (wc-command file)
(call-with-values
(call-with-input-file file lines+chars)
(lambda (lines words chars) ...)))
--
`~Eric