Commits

Moritz Heidkamp committed a1bb0b0

Implement lazy-null and lazy-list for convenience

  • Participants
  • Parent commits d269524

Comments (0)

Files changed (1)

 (module lazy-seq
 
-(lazy-seq make-lazy-seq
+(lazy-seq make-lazy-seq lazy-null
  lazy-seq? lazy-seq-realized? lazy-null? 
- lazy-seq->list list->lazy-seq
+ lazy-seq->list list->lazy-seq lazy-list
  lazy-head lazy-tail lazy-length
  lazy-append lazy-reverse
  lazy-take lazy-drop lazy-ref
 (define (lazy-seq-realized? seq)
   (not (lazy-seq-body seq)))
 
+(define lazy-null
+  (lazy-seq '()))
+
 (define (lazy-null? seq)
   (null? (realized-lazy-seq seq)))
 
             (lazy-seq->list
              (lazy-tail seq)))))
 
+(define (lazy-list . elements)
+  (list->lazy-seq elements))
+
 (define (list->lazy-seq list)
   (if (null? list)
       (%make-lazy-seq #f '())