Loading ...
Sorry, an error occurred while loading the content.

ex 3.75

Expand Messages
  • John Berthels
    Hello to anyone still reading :-) Looking at the code for make-zero-crossings given in ex 3.75, we have to find the error. It seems to me that the given
    Message 1 of 3 , Nov 14, 2005
    • 0 Attachment
      Hello to anyone still reading :-)

      Looking at the code for make-zero-crossings given in ex 3.75, we have
      to find the error.

      It seems to me that the given function is broken on non-infinite unput
      streams. The recursion doesn't contain a base case for the empty
      stream.

      But that answer doesn't seem to tally with the hint that an extra
      argument is needed, since I think I'd just need to add that case to,
      rather than an extra arg.

      Would anyone care to point out to me what I'm missing here?

      regards,

      jb
    • Ioura Batugowski
      The average is passed on as last-value, so it s not the average of the last two values but is influenced by all previous values (with exponentially decreasing
      Message 2 of 3 , Nov 14, 2005
      • 0 Attachment
        The average is passed on as last-value, so it's not the average of the
        last two values but is influenced by all previous values (with
        exponentially decreasing contribution the older the value is). One
        would fix it by passing (stream-car input-stream) instead of avpt as
        last-value, but then the last-value used in the sign change detector
        isn't smoothed. So we must pass both (stream-car input-stream) and
        avpt to make-zero-crossings.

        Ioura

        On 11/14/05, John Berthels <john.berthels@...> wrote:
        > Hello to anyone still reading :-)
        >
        > Looking at the code for make-zero-crossings given in ex 3.75, we have
        > to find the error.
        >
        > It seems to me that the given function is broken on non-infinite unput
        > streams. The recursion doesn't contain a base case for the empty
        > stream.
        >
        > But that answer doesn't seem to tally with the hint that an extra
        > argument is needed, since I think I'd just need to add that case to,
        > rather than an extra arg.
        >
        > Would anyone care to point out to me what I'm missing here?
        >
        > regards,
        >
        > jb
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
      • John Berthels
        ... Thanks very much. I m a little annoyed that I didn t spot that. Ah well. regards, jb
        Message 3 of 3 , Nov 15, 2005
        • 0 Attachment
          On 11/14/05, Ioura Batugowski <ibatugow@...> wrote:
          > The average is passed on as last-value, so it's not the average of the
          > last two values but is influenced by all previous values (with
          > exponentially decreasing contribution the older the value is). One
          > would fix it by passing (stream-car input-stream) instead of avpt as
          > last-value, but then the last-value used in the sign change detector
          > isn't smoothed. So we must pass both (stream-car input-stream) and
          > avpt to make-zero-crossings.

          Thanks very much. I'm a little annoyed that I didn't spot that. Ah well.

          regards,

          jb
        Your message has been successfully submitted and would be delivered to recipients shortly.