I'm trying to learn newLISP by solving some of the Project Euler problems. I'm currently working on Problem 4 using streams, using some functions from viewtopic.php?f=5&t=2162. (It's the task I was given by my mentor.)
I'm trying to use the 2nd syntax of letex, but I must have something wrong because I get "ERR: list or string expected in function empty? s2".
Code: Select all
(define (product-stream-Reuler s1 s2 , s3) 
  (setf s3 (if
    (empty-stream? s1) the-empty-stream
    (empty-stream? s2) the-empty-stream
    (letex (
      a1 (head s1)
      a2 (head s2)
      c1 (tail s1)
      c2 (tail s2)
      )
      (println "a1=" 'a1 ", a2=" 'a2 "\ns1=" 's1 ", s2=" 's2 "\nc1=" 'c1)
      (accumulate cons '()
        (cons-stream
          ; first palindrome product of (* n s2)
          (head 
            (filter-stream palindrome?
              (product-stream (num-stream 'a1) 's2)
            )
          )
          ; re-run with next n
          (product-stream-Reuler 'c1 's2)
        )
      )
    )
  ))
  s3
)
; a and b are streams of the integers from 999 to 100
(product-stream-Reuler a b)
What bit of letex am I misunderstanding?
Thank you for your help.