MACROs in Scheme Library slib1b0 
Author Message
 MACROs in Scheme Library slib1b0

SLIB is a portable scheme library written in R4RS and P1178 scheme.

New additions to SLIB include syntactic closure macros, records, prime
number test and factoring, and plotting on character displays.  Dirk
Lutzebaeck has extended format.scm.

The macro package should be able to add syntactic closure macros
(addendum to R4RS) to any R4RS implementation.

  ftp altdorf.ai.mit.edu [18.43.0.246] (anonymous)
  cd archive/scm
or
  ftp nexus.yorku.ca (anonymous)
  cd pub/oz/scheme/new

These directories contain the distribution version 1b0 of SLIB.
  `slib1b0.shar' is a shar file of a Scheme Library.
  `slib1b0.tar.Z' is a compressed tar file of a Scheme Library.



Sun, 17 Jul 1994 13:20:23 GMT  
 MACROs in Scheme Library slib1b0
Some systems offer PRETTY-PRINT but not PRETTY-PRINT-TO-STRING.  So
PP.SCM should be split so that these systems can use just
PP-TO-STRING.  It looks as though much of the PP-TO-STRING code could
be shared with FORMAT.SCM.  Is it possible to create a portable
STRING-I/O package?

The FACTOR algorithm is not the best.  Does someone have code for
Pollard-Rho or eliptical function factoring?

No one has taken me up on my request for someone to test the random
number functions.  Knuth Vol. 2 has tests.

RECORD.SCM is not complete.  Making it faster would also improve the
performance of SC-MACRO.SCM.

SLIB should have a uniform ERROR interface.  Can someone who is
familiar with several Scheme implementations scope out a portable
ERROR call?


package to SLIB.



Sun, 17 Jul 1994 13:49:13 GMT  
 MACROs in Scheme Library slib1b0
There were several misplaced parenthesis in slib1b0.  I have put
fixed versions (slib1a1) in the usual places.  Here is a patch for
slib1a0:
----------------------------------------------------------------------
diff -c slib1b0/prime.scm slib/prime.scm
*** slib1b0/prime.scm   Fri Jan 31 00:35:41 1992
--- slib/prime.scm      Fri Jan 31 00:27:42 1992
***************
*** 64,70 ****

  (define (prime:prime? n)
    (set! n (abs n))
!   (cond ((<= n 31) (memv n '(2 3 5 7 11 13 17 19 23 31)))
        ((= 1 (gcd n prime:product))
         (do ((i prime:trials (- i 1))
              (a (+ 1 (random (- n 1))) (+ 1 (random (- n 1)))))
--- 64,71 ----

  (define (prime:prime? n)
    (set! n (abs n))
!   (cond ((<= n 31)
!        (and (memv n '(2 3 5 7 11 13 17 19 23 31)) #t))
        ((= 1 (gcd n prime:product))
         (do ((i prime:trials (- i 1))
              (a (+ 1 (random (- n 1))) (+ 1 (random (- n 1)))))
***************
*** 72,79 ****
                        (= (gcd a n) 1)
                        (= (modulo (jacobi-symbol a n) n)
                           (modular:expt n a (quotient (- n 1) 2)))))
!             (if (positive? i) #f #t)))
!        (else #f))))

  ;;;;Lankinen's recursive factoring algorithm:

--- 73,80 ----
                        (= (gcd a n) 1)
                        (= (modulo (jacobi-symbol a n) n)
                           (modular:expt n a (quotient (- n 1) 2)))))
!             (if (positive? i) #f #t))))
!       (else #f)))

  ;;;;Lankinen's recursive factoring algorithm:

diff -c slib1b0/promise.scm slib/promise.scm
*** slib1b0/promise.scm Fri Jan 31 00:35:42 1992
--- slib/promise.scm    Thu Jan 30 00:18:46 1992
***************
*** 11,21 ****
        (if result-ready?
            result
            (let ((x (proc)))
!             if result-ready?
!             result
!             (begin (set! result-ready? #t)
!                    (set! result x)
!                    result)))))))

  ;;; change occurences of (DELAY <expression>) to
  ;;; (MAKE-PROMISE (LAMBDA () <expression>))
--- 11,21 ----
        (if result-ready?
            result
            (let ((x (proc)))
!             (if result-ready?
!                 result
!                 (begin (set! result-ready? #t)
!                        (set! result x)
!                        result))))))))

  ;;; change occurences of (DELAY <expression>) to
  ;;; (MAKE-PROMISE (LAMBDA () <expression>))



Tue, 19 Jul 1994 14:38:19 GMT  
 MACROs in Scheme Library slib1b0
There are some misplaced parenthesis in sbli1b0.  I have put a new
version slib1b1 on

altdorf.ai.mit.edu:archive/scm/
and
nexus.yorku.ca:pub/oz/scheme/new/

Here is the patch from slib1b0 to slib1b1:

diff -c slib1b0/prime.scm slib/prime.scm
*** slib1b0/prime.scm   Fri Jan 31 00:35:41 1992
--- slib/prime.scm      Fri Jan 31 00:27:42 1992
***************
*** 64,70 ****

  (define (prime:prime? n)
    (set! n (abs n))
!   (cond ((<= n 31) (memv n '(2 3 5 7 11 13 17 19 23 31)))
        ((= 1 (gcd n prime:product))
         (do ((i prime:trials (- i 1))
              (a (+ 1 (random (- n 1))) (+ 1 (random (- n 1)))))
--- 64,71 ----

  (define (prime:prime? n)
    (set! n (abs n))
!   (cond ((<= n 31)
!        (and (memv n '(2 3 5 7 11 13 17 19 23 31)) #t))
        ((= 1 (gcd n prime:product))
         (do ((i prime:trials (- i 1))
              (a (+ 1 (random (- n 1))) (+ 1 (random (- n 1)))))
***************
*** 72,79 ****
                        (= (gcd a n) 1)
                        (= (modulo (jacobi-symbol a n) n)
                           (modular:expt n a (quotient (- n 1) 2)))))
!             (if (positive? i) #f #t)))
!        (else #f))))

  ;;;;Lankinen's recursive factoring algorithm:

--- 73,80 ----
                        (= (gcd a n) 1)
                        (= (modulo (jacobi-symbol a n) n)
                           (modular:expt n a (quotient (- n 1) 2)))))
!             (if (positive? i) #f #t))))
!       (else #f)))

  ;;;;Lankinen's recursive factoring algorithm:

diff -c slib1b0/promise.scm slib/promise.scm
*** slib1b0/promise.scm Fri Jan 31 00:35:42 1992
--- slib/promise.scm    Thu Jan 30 00:18:46 1992
***************
*** 11,21 ****
        (if result-ready?
            result
            (let ((x (proc)))
!             if result-ready?
!             result
!             (begin (set! result-ready? #t)
!                    (set! result x)
!                    result)))))))

  ;;; change occurences of (DELAY <expression>) to
  ;;; (MAKE-PROMISE (LAMBDA () <expression>))
--- 11,21 ----
        (if result-ready?
            result
            (let ((x (proc)))
!             (if result-ready?
!                 result
!                 (begin (set! result-ready? #t)
!                        (set! result x)
!                        result))))))))

  ;;; change occurences of (DELAY <expression>) to
  ;;; (MAKE-PROMISE (LAMBDA () <expression>))



Wed, 20 Jul 1994 02:13:20 GMT  
 MACROs in Scheme Library slib1b0
I'm having trouble getting the pretty-print function in library file
pp.scm to work.  This is from library file slib1b0 which is intended to
function with Scheme interpreter scm3c.   Is there a bug in this code?

Greg.



Thu, 21 Jul 1994 13:40:10 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Scheme macro source: rewriter-widget, a widely applicable macro interface

2. Scheme/Dylan incompatibilities (Dyllo as a Scheme library)

3. Scheme/Dylan incompatibilities (Dyllo as a Scheme library)

4. A macro involving two sub-macros - where the 2nd macro needs results from the first

5. Metaprogramming: C++ templates vs Scheme macros?

6. Haskell functions as CL/Scheme macros

7. Macros in scheme-style syntax

8. Macros in Common Lisp, Scheme, and other languages

9. Scheme R4RS Macros

10. The woes of Scheme macros - HELP!

11. lecture notes on macro's in scheme?

12. Macros in MIT Scheme

 

 
Powered by phpBB® Forum Software