chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #1703: Arguments being passed to procedure incorrectly


From: Chicken Trac
Subject: Re: #1703: Arguments being passed to procedure incorrectly
Date: Mon, 20 Jul 2020 17:31:21 -0000

#1703: Arguments being passed to procedure incorrectly
----------------------------------------+----------------------
            Reporter:  Jakob L. Kreuze  |      Owner:  sjamaan
                Type:  defect           |     Status:  accepted
            Priority:  major            |  Milestone:  someday
           Component:  compiler         |    Version:  5.2.0
          Resolution:                   |   Keywords:
Estimated difficulty:  hard             |
----------------------------------------+----------------------

Comment (by felix winkelmann):

 Here a slightly simplified variant:

 {{{
 (define (reduce proc list init)
   (define (reduce-iter list result)
     (if (null? list)
         result
         (reduce-iter (cdr list) (proc result (car list)))))
   (reduce-iter list init))

 (define (vec3- . vecs)
   (define (sub u v)
     (vector (- (vector-ref u 0) (vector-ref v 0))
             (- (vector-ref u 1) (vector-ref v 1))
             (- (vector-ref u 2) (vector-ref v 2))))
   (reduce sub (cdr vecs) (car vecs)))

 (vec3- #(1.00 1.00 1.00)
        #(1.00 1.00 1.00)
        #(1.00 1.00 1.00))
 }}}

 which results in

 {{{
 Error: (vector-ref) bad argument type: #<procedure (sub u v)>

         Call history:

         x.scm:15: vec3-
         x.scm:13: reduce
         x.scm:6: reduce-iter
         x.scm:5: proc           <--
 }}}

 `csc -debug 7` looks ok to me. Making `sub` trivial seems to make it run
 to completion, but again, the debug output doesn't show any noteworthy
 difference.

-- 
Ticket URL: <https://bugs.call-cc.org/ticket/1703#comment:2>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]