Changeset 39696 in project


Ignore:
Timestamp:
03/13/21 22:28:24 (6 weeks ago)
Author:
Kon Lovett
Message:

fix record-printer, fix warning param

Location:
release/5/stack/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/stack/trunk/stack.egg

    r39694 r39696  
    33
    44((synopsis "Provides LIFO queue (stack) operations")
    5  (version "3.0.5")
     5 (version "3.0.6")
    66 (category data)
    77 (author "Kon Lovett")
  • release/5/stack/trunk/stack.scm

    r39694 r39696  
    240240;;; Read/Print Syntax
    241241
    242 (define-record-printer (stack stk out) (format out (stack-literal-format) (%stack-list stk)))
    243 
    244 (define-reader-ctor 'stack list->stack)
    245 
    246242(define stack-literal-form
    247   (make-parameter 'srfi-10
     243  (make-parameter 'unread
    248244    (lambda (x)
    249245      (case x
     
    251247        ((UNREAD unread)    'unread )
    252248        (else
    253           (warning 'stack-literal-format "invalid form symbol; 'srfi-10 or 'unread" x)
    254           (stack-literal-format))))))
    255 
    256 (define-constant SRFI-10-FORMAT "#,(stack ~A)")
    257 (define-constant UNREAD-FORMAT "#<stack ~A>")
    258 
    259 (define (stack-literal-format)
     249          (warning 'stack-literal-form "invalid form symbol; 'srfi-10 or 'unread" x)
     250          (stack-literal-form))))))
     251
     252(define (stack-print stk out)
    260253  (case (stack-literal-form)
    261     ((srfi-10)  SRFI-10-FORMAT )
    262     (else       UNREAD-FORMAT ) ) )
     254    ((srfi-10)  (format out "#,(stack ~A)" (%stack-list stk)) )
     255    (else       (format out "#<stack ~A>" (%stack-count stk)) ) ) )
     256
     257(set! (record-printer stack) stack-print)
     258
     259(define-reader-ctor 'stack list->stack)
    263260
    264261) ;module stack
Note: See TracChangeset for help on using the changeset viewer.