Ticket #1654: holes.patch

File holes.patch, 2.1 KB (added by sjamaan, 4 years ago)

Fix for the issue, sent by mail to Juergen

  • holes-params.scm

     
     1(module holes-params (hole-delimiters)
     2  (import scheme (only (chicken base) make-parameter))
     3 
     4(define hole-delimiters
     5  (make-parameter "<>"
     6                  (lambda (arg)
     7                    (if (and (string? arg)
     8                             (or (string=? arg "!!")
     9                                 (string=? arg "<>")))
     10                        arg
     11                        "<>"))
     12                  )))
  • holes.egg

     
    55 (test-dependencies simple-tests)
    66 (author "[[Juergen Lorenz]]")
    77 (version "1.1")
    8  (components (extension holes)))
    9 
    10 
     8 (components (extension holes
     9                        (component-dependencies holes-params))
     10             (extension holes-params)))
  • holes.scm

     
    5555                set-sharp-read-syntax!
    5656                set-read-syntax!))
    5757  (import-for-syntax (only (chicken base) receive)
    58                      (only (chicken fixnum) fx- fx+ fx=))
     58                     (only (chicken fixnum) fx- fx+ fx=)
     59                     holes-params)
    5960
    60 (define-for-syntax hole-delimiters
    61   (make-parameter "<>"
    62                   (lambda (arg)
    63                     (if (and (string? arg)
    64                              (or (string=? arg "!!")
    65                                  (string=? arg "<>")))
    66                         arg
    67                         "<>"))
    68                   ))
    6961;;; (@@ code)
    7062;;; ---------
    7163;;; returns a procedure with arguments the holes in code
  • tests/run.scm

     
    11(import holes simple-tests)
     2(import holes-params)
    23
    3 
    44(pe '(@@ (+ !1! 5)))
    55(pe '(@@ '(1 . 2)))
    66(pe '(@@ (+ 5 (* !! 2))))