Changeset 33794 in project for release


Ignore:
Timestamp:
01/11/17 15:42:34 (2 years ago)
Author:
juergen
Message:

simple-exceptions 0.4 with named-lambda

Location:
release/4/simple-exceptions
Files:
3 edited
4 copied

Legend:

Unmodified
Added
Removed
  • release/4/simple-exceptions/tags/0.4/simple-exceptions.scm

    r33780 r33794  
    3737(module simple-exceptions
    3838  (simple-exceptions exception? exception-of? make-exception
    39    pre-exception post-exception << >> true? false?
     39   pre-exception post-exception << >> true? false? named-lambda
    4040   location message arguments raise with-exn-handler guard assert*)
    4141  (import scheme
     
    9292(define post-exception
    9393  (make-exception "postcondition violated" 'results))
     94
     95;;; (named-lambda name args xpr . xprs)
     96;;; -----------------------------------
     97;;; can replace anonymous procedures in << and >>
     98;;; to improve error messages
     99(define-syntax named-lambda
     100  (syntax-rules ()
     101    ((_ name args xpr . xprs)
     102     (letrec ((name (lambda args xpr . xprs)))
     103       name))))
    94104
    95105;;; (<< x x? ...)
     
    297307      (condition-case xpr ([var] (kind ...) body) . other-clauses)
    298308      "reexport of Chicken's macro")
     309    (named-lambda
     310      macro:
     311      (named-lambda name args xpr . xprs)
     312      "can be used in place of lambda,"
     313      "possibly improving error messages")
    299314    (<<
    300315      procedure:
  • release/4/simple-exceptions/tags/0.4/simple-exceptions.setup

    r33780 r33794  
    77 'simple-exceptions
    88 '("simple-exceptions.so" "simple-exceptions.import.so")
    9  '((version "0.3.1")))
     9 '((version "0.4")))
  • release/4/simple-exceptions/tags/0.4/tests/run.scm

    r33774 r33794  
    44(define-test (simple-exceptions?)
    55  (check
     6    "NAMED LAMBDA"
     7    (= ((named-lambda ! (n)
     8          (if (zero? n)
     9            1
     10            (* n (! (- n 1)))))
     11        5)
     12       120)
    613    "CHECKS"
    7     (= (<< 5 integer? odd?) 5)
     14    (= (<< 5 integer? odd? (named-lambda 5<= (x) (<= 5 x))) 5)
    815    (not (condition-case
    916           (>> 5 integer? even?)
  • release/4/simple-exceptions/trunk/simple-exceptions.scm

    r33780 r33794  
    3737(module simple-exceptions
    3838  (simple-exceptions exception? exception-of? make-exception
    39    pre-exception post-exception << >> true? false?
     39   pre-exception post-exception << >> true? false? named-lambda
    4040   location message arguments raise with-exn-handler guard assert*)
    4141  (import scheme
     
    9292(define post-exception
    9393  (make-exception "postcondition violated" 'results))
     94
     95;;; (named-lambda name args xpr . xprs)
     96;;; -----------------------------------
     97;;; can replace anonymous procedures in << and >>
     98;;; to improve error messages
     99(define-syntax named-lambda
     100  (syntax-rules ()
     101    ((_ name args xpr . xprs)
     102     (letrec ((name (lambda args xpr . xprs)))
     103       name))))
    94104
    95105;;; (<< x x? ...)
     
    297307      (condition-case xpr ([var] (kind ...) body) . other-clauses)
    298308      "reexport of Chicken's macro")
     309    (named-lambda
     310      macro:
     311      (named-lambda name args xpr . xprs)
     312      "can be used in place of lambda,"
     313      "possibly improving error messages")
    299314    (<<
    300315      procedure:
  • release/4/simple-exceptions/trunk/simple-exceptions.setup

    r33780 r33794  
    77 'simple-exceptions
    88 '("simple-exceptions.so" "simple-exceptions.import.so")
    9  '((version "0.3.1")))
     9 '((version "0.4")))
  • release/4/simple-exceptions/trunk/tests/run.scm

    r33774 r33794  
    44(define-test (simple-exceptions?)
    55  (check
     6    "NAMED LAMBDA"
     7    (= ((named-lambda ! (n)
     8          (if (zero? n)
     9            1
     10            (* n (! (- n 1)))))
     11        5)
     12       120)
    613    "CHECKS"
    7     (= (<< 5 integer? odd?) 5)
     14    (= (<< 5 integer? odd? (named-lambda 5<= (x) (<= 5 x))) 5)
    815    (not (condition-case
    916           (>> 5 integer? even?)
Note: See TracChangeset for help on using the changeset viewer.