Changeset 29274 in project


Ignore:
Timestamp:
06/28/13 17:30:53 (8 years ago)
Author:
juergen
Message:

List-finite? corrected, List-infinite? and Realize added

Location:
release/4/lazy-lists
Files:
2 edited
5 copied

Legend:

Unmodified
Added
Removed
  • release/4/lazy-lists/tags/0.4/lazy-lists.scm

    r29251 r29274  
    3232; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3333;
    34 ; Last update: June 26, 2013
     34; Last update: June 28, 2013
    3535;
    3636(require-library multi-methods)
     
    4141   First Rest Car Cdr Length Length-min Append Reverse
    4242   List? Null? Realized? Reverse* Index
     43   List-infinite? Realize
    4344   List-not-null? List-finite? Lists-one-finite?
    4445   Take Drop Ref Take-upto Drop-upto
     
    6061              define-record-printer
    6162              cut
     63              when
    6264              void
    6365              add1
     
    539541
    540542(define (List-finite? xpr)
    541   (and (List xpr) (if (Length xpr) #t #f)))
     543  (and (List? xpr) (if (Length xpr) #t #f)))
     544
     545(define (List-infinite? xpr)
     546  (and (List? xpr) (if (Length xpr) #f #t)))
    542547
    543548(define (Lists-one-finite? . Lsts)
     
    547552         (if len #t #f))))
    548553
     554;; only finite Lists
     555(define (Realize Lst)
     556  (let ((len (lazy-list-length Lst)))
     557    (when len
     558      (Ref (- len 1) Lst)
     559      Lst)))
     560 
    549561) ; module %lazy-lists
    550562
    551 (module lazy-lists *
    552 ;  (lazy-lists Lazy Make-lazy Car Cdr Nil Cons
    553 ;              List->list list->List input->List
    554 ;              First Rest Length Length-min Append Reverse
    555 ;              List-not-null? List-finite? Lists-one-finite?
    556 ;              List? Null? Realized? Reverse*
    557 ;              Take Drop Ref Take-upto Drop-upto
    558 ;              Memp Member Memq Memv Index
    559 ;              Equ? Equal? Eq? Eqv?
    560 ;              Assp Assoc Assq Assv
    561 ;              Map Filter Sieve For-each
    562 ;              Iterate Repeat Repeatedly
    563 ;              Cardinals Primes Cycle Interval
    564 ;              Merge Sort Sorted? Split-at Split-with
    565 ;              vector->List List->vector
    566 ;              Fold-right Fold-left Fold-right* Fold-left* Zip
    567 ;              Every? Some? List)
     563(module lazy-lists
     564  (lazy-lists Lazy Make-lazy Car Cdr Nil Cons
     565              List->list list->List input->List
     566              First Rest Length Length-min Append Reverse
     567              List-not-null? List-finite? Lists-one-finite?
     568              List? Null? Realized? Reverse*
     569              List-infinite? Realize
     570              Take Drop Ref Take-upto Drop-upto
     571              Memp Member Memq Memv Index
     572              Equ? Equal? Eq? Eqv?
     573              Assp Assoc Assq Assv
     574              Map Filter Sieve For-each
     575              Iterate Repeat Repeatedly
     576              Cardinals Primes Cycle Interval
     577              Merge Sort Sorted? Split-at Split-with
     578              vector->List List->vector
     579              Fold-right Fold-left Fold-right* Fold-left* Zip
     580              Every? Some? List)
    568581
    569582(import scheme
     
    711724          ('1any? any?)))
    712725
     726(define List-infinite?
     727  (method ('List-finite?  %List-infinite? boolean-checker)
     728          ('1any? any?)))
     729
    713730(define Lists-one-finite?
    714731  (method #t ; variadic
     
    757774  (method ('Cdr %Cdr List-checker)
    758775          ('1List-not-null? %List-not-null?)))
     776
     777(define Realize
     778  (method ('Realize %Realize List-checker)
     779          ('1List-finite? %List-finite?)))
    759780
    760781(define Ref
     
    12621283  (sort
    12631284    '(Lazy List Make-lazy
    1264        List-not-null? List-finite?
     1285       List-not-null? List-finite? List-infinite?
    12651286       Equ? Equal? Eq? Eqv?
    1266        List? Null? Realized?
     1287       List? Null? Realized? Realize
    12671288       Every? Some?
    12681289       Car Cdr Nil Cons
  • release/4/lazy-lists/tags/0.4/lazy-lists.setup

    r29251 r29274  
    88 'lazy-lists
    99 '("lazy-lists.so" "lazy-lists.import.so" "%lazy-lists.import.so")
    10  '((version "0.3")))
     10 '((version "0.4")))
  • release/4/lazy-lists/trunk/lazy-lists.scm

    r29251 r29274  
    3232; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3333;
    34 ; Last update: June 26, 2013
     34; Last update: June 28, 2013
    3535;
    3636(require-library multi-methods)
     
    4141   First Rest Car Cdr Length Length-min Append Reverse
    4242   List? Null? Realized? Reverse* Index
     43   List-infinite? Realize
    4344   List-not-null? List-finite? Lists-one-finite?
    4445   Take Drop Ref Take-upto Drop-upto
     
    6061              define-record-printer
    6162              cut
     63              when
    6264              void
    6365              add1
     
    539541
    540542(define (List-finite? xpr)
    541   (and (List xpr) (if (Length xpr) #t #f)))
     543  (and (List? xpr) (if (Length xpr) #t #f)))
     544
     545(define (List-infinite? xpr)
     546  (and (List? xpr) (if (Length xpr) #f #t)))
    542547
    543548(define (Lists-one-finite? . Lsts)
     
    547552         (if len #t #f))))
    548553
     554;; only finite Lists
     555(define (Realize Lst)
     556  (let ((len (lazy-list-length Lst)))
     557    (when len
     558      (Ref (- len 1) Lst)
     559      Lst)))
     560 
    549561) ; module %lazy-lists
    550562
    551 (module lazy-lists *
    552 ;  (lazy-lists Lazy Make-lazy Car Cdr Nil Cons
    553 ;              List->list list->List input->List
    554 ;              First Rest Length Length-min Append Reverse
    555 ;              List-not-null? List-finite? Lists-one-finite?
    556 ;              List? Null? Realized? Reverse*
    557 ;              Take Drop Ref Take-upto Drop-upto
    558 ;              Memp Member Memq Memv Index
    559 ;              Equ? Equal? Eq? Eqv?
    560 ;              Assp Assoc Assq Assv
    561 ;              Map Filter Sieve For-each
    562 ;              Iterate Repeat Repeatedly
    563 ;              Cardinals Primes Cycle Interval
    564 ;              Merge Sort Sorted? Split-at Split-with
    565 ;              vector->List List->vector
    566 ;              Fold-right Fold-left Fold-right* Fold-left* Zip
    567 ;              Every? Some? List)
     563(module lazy-lists
     564  (lazy-lists Lazy Make-lazy Car Cdr Nil Cons
     565              List->list list->List input->List
     566              First Rest Length Length-min Append Reverse
     567              List-not-null? List-finite? Lists-one-finite?
     568              List? Null? Realized? Reverse*
     569              List-infinite? Realize
     570              Take Drop Ref Take-upto Drop-upto
     571              Memp Member Memq Memv Index
     572              Equ? Equal? Eq? Eqv?
     573              Assp Assoc Assq Assv
     574              Map Filter Sieve For-each
     575              Iterate Repeat Repeatedly
     576              Cardinals Primes Cycle Interval
     577              Merge Sort Sorted? Split-at Split-with
     578              vector->List List->vector
     579              Fold-right Fold-left Fold-right* Fold-left* Zip
     580              Every? Some? List)
    568581
    569582(import scheme
     
    711724          ('1any? any?)))
    712725
     726(define List-infinite?
     727  (method ('List-finite?  %List-infinite? boolean-checker)
     728          ('1any? any?)))
     729
    713730(define Lists-one-finite?
    714731  (method #t ; variadic
     
    757774  (method ('Cdr %Cdr List-checker)
    758775          ('1List-not-null? %List-not-null?)))
     776
     777(define Realize
     778  (method ('Realize %Realize List-checker)
     779          ('1List-finite? %List-finite?)))
    759780
    760781(define Ref
     
    12621283  (sort
    12631284    '(Lazy List Make-lazy
    1264        List-not-null? List-finite?
     1285       List-not-null? List-finite? List-infinite?
    12651286       Equ? Equal? Eq? Eqv?
    1266        List? Null? Realized?
     1287       List? Null? Realized? Realize
    12671288       Every? Some?
    12681289       Car Cdr Nil Cons
  • release/4/lazy-lists/trunk/lazy-lists.setup

    r29251 r29274  
    88 'lazy-lists
    99 '("lazy-lists.so" "lazy-lists.import.so" "%lazy-lists.import.so")
    10  '((version "0.3")))
     10 '((version "0.4")))
Note: See TracChangeset for help on using the changeset viewer.