Changeset 12565 in project


Ignore:
Timestamp:
11/21/08 01:40:27 (13 years ago)
Author:
Ivan Raikov
Message:

Added doc:empty? procedure.

Location:
release/3/strictly-pretty/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/3/strictly-pretty/trunk/strictly-pretty.scm

    r12060 r12565  
    2929(define-extension strictly-pretty)
    3030
    31 (declare (export doc? doc:cons doc:empty doc:text doc:nest doc:break
    32                  doc:break-with doc:group doc:concat
     31(declare (export doc? doc:cons doc:empty doc:empty? doc:text
     32                 doc:nest doc:break doc:break-with doc:group doc:concat
    3333                 doc:binop doc:ifthen doc:list doc:block doc:letblk
    3434                 doc:space doc:comma doc:connect
     
    8686(define (doc:break-with s)  (DocBreak s))
    8787(define (doc:group x)   (DocGroup x))
     88
     89(define (doc:empty? x)     (and (doc? x) (cases doc x (DocNil () #t) (else #f))))
    8890
    8991(define (doc:connect x y)
     
    213215(define (doc:letblk indent l i e)
    214216  (lambda (e1 e2)
    215     (doc:group (doc:connect (doc:nest indent (doc:connect l (doc:group e1)))
    216                             (doc:connect (doc:nest indent (doc:connect i (doc:group e2))) e)))))
     217    (if (doc:empty? e1) e2
     218        (doc:group (doc:connect (doc:nest indent (doc:connect l (doc:group e1)))
     219                                (doc:connect (doc:nest indent (doc:connect i (doc:group e2))) e))))))
    217220       
    218221
  • release/3/strictly-pretty/trunk/strictly-pretty.setup

    r12060 r12565  
    2020
    2121  ; Assoc list with properties for your extension:
    22   '((version 1.2)
     22  '((version 1.3)
    2323    (documentation "strictly-pretty.html")
    2424    ,@(if has-exports? `((exports "strictly-pretty.exports")) (list)) ))
Note: See TracChangeset for help on using the changeset viewer.