PasteRack.org
Paste # 36547
2019-09-14 09:22:55

Fork as a new paste.

Paste viewed 194 times.


Embed:

  1. #lang racket
  2. (require rackunit)
  3. (define ones (lambda () (cons 1 ones)))
  4.  
  5. (define (stream-for-n-steps s n)
  6.   (if (= n 0)
  7.         (car (s))
  8.         (cons (car (s)) (stream-for-n-steps ((cdr (s)) (- n 1))))))
  9.  
  10.  
  11. (check-equal? (stream-for-n-steps ones 2) (list 1 1) "test 0")

=>

ones: arity mismatch;

 the expected number of arguments does not match the given

number

  expected: 0

  given: 1

  arguments...:

   1