Waldek,

I was a bit confused by this...

"Interpreter" parser treats 'break', 'default', 'define', 'do', 'export',
'free', 'inline', 'local', 'macro', 'rule' as keywords, but
the compiler parser do not.

Here is the session with the attached programs where I replaced "leave" in Martin's program by "break".

Don't these programs now behave like Martin expected? In particular, the SPAD compiler seems to understand "break".

Ralf

---------------------------------------------------------------------
>fricas
Checking for foreign routines AXIOM="/home/hemmecke/software/lib/fricas/target/i686-pc-linux"
spad-lib="/home/hemmecke/software/lib/fricas/target/i686-pc-linux/lib/libspad.so"
foreign routines found openServer result 0 FriCAS (AXIOM fork) Computer Algebra System Version: FriCAS 2009-10-15 Timestamp: Wednesday October 21, 2009 at 19:42:13 ----------------------------------------------------------------------------- Issue )copyright to view copyright notices. Issue )summary for a summary of useful system commands. Issue )quit to leave FriCAS and return to shell. -----------------------------------------------------------------------------


(1) -> (1) -> )co rabin.spad Compiling FriCAS source code from file /home/hemmecke/scratch/rabin.spad using old system compiler. RABIN abbreviates package Rabin processing macro definition Z ==> Integer

------------------------------------------------------------------------
   initializing NRLIB RABIN for Rabin
   compiling into NRLIB RABIN
compiling exported rabin : (Integer,Integer,Integer,Integer,NonNegativeInteger) -> Boolean

Time: 0.09 SEC.

(time taken in buildFunctor:  0)

;;;     ***       |Rabin| REDEFINED

;;;     ***       |Rabin| REDEFINED
Time: 0.004 SEC.


   Cumulative Statistics for Constructor Rabin
      Time: 0.10 seconds

   finalizing NRLIB RABIN
   Processing Rabin for Browser database:
--->-->Rabin((rabin ((Boolean) Z Z Z Z (NonNegativeInteger)))): Not documented!!!! --->-->Rabin(constructor): Not documented!!!! --->-->Rabin(): Missing Description ; compiling file "/home/hemmecke/scratch/RABIN.NRLIB/RABIN.lsp" (written 09 JAN 2010 09:38:10 PM): ; compiling (/VERSIONCHECK 2) ; compiling (DEFUN |RABIN;rabin;4INniB;1| ...) ; compiling (DEFUN |Rabin| ...) ; compiling (DEFUN |Rabin;| ...) ; compiling (MAKEPROP (QUOTE |Rabin|) ...) ; compiling (MAKEPROP (QUOTE |Rabin|) ...) ; file: /home/hemmecke/scratch/RABIN.NRLIB/RABIN.lsp ; in: DEFUN |Rabin;| ; (BOOT::|haddProp| BOOT::|$ConstructorCache| 'BOOT::|Rabin| NIL ; (CONS 1 BOOT::$)) ; ; caught WARNING: ; undefined variable: |$ConstructorCache|

; in: DEFUN |Rabin|
;     (VMLISP:HGET BOOT::|$ConstructorCache| 'BOOT::|Rabin|)
; --> GETHASH
; ==>
;   (SB-IMPL::GETHASH3 'BOOT::|Rabin| BOOT::|$ConstructorCache| NIL)
;
; caught WARNING:
;   undefined variable: |$ConstructorCache|

; in: DEFUN |RABIN;rabin;4INniB;1|
;     (BOOT::LETT #:G715 BOOT::|$NoValue| BOOT::|RABIN;rabin;4INniB;1|)
; --> SETQ
; ==>
;   (THE #<SB-KERNEL:NAMED-TYPE T> BOOT::|$NoValue|)
;
; caught WARNING:
;   undefined variable: |$NoValue|

;
; caught WARNING:
;   These variables are undefined:
;     |$ConstructorCache| |$NoValue|
;
; compilation unit finished
;   caught 4 WARNING conditions


; /home/hemmecke/scratch/RABIN.NRLIB/RABIN.fasl written
; compilation finished in 0:00:00
------------------------------------------------------------------------
   Rabin is now explicitly exposed in frame frame1
   Rabin will be automatically loaded when needed from
      /home/hemmecke/scratch/RABIN.NRLIB/RABIN

(1) -> rabin(2,41,40,5,3)
   "check j 1"
   leaving
   check t = -1 after loop
   after t = 1 or t = -1

   (1)  false
Type: Boolean
(2) -> )r rabin.input
rb(p,n,nm1,q,k) ==
         -- probability n prime is > 3/4 for each iteration
         -- for most n this probability is much greater than 3/4
         t := powmod(p, q, n)
         -- neither of these cases tells us anything
--         if not (one? t or t = nm1) then
         if not ((t = 1) or t = nm1) then
            for j in 1..k-1 repeat
               print(concat("check j ", string(j)$String)::OutputForm)
               oldt := t
               t := mulmod(t, t, n)
--               one? t => return true
               (t = 1) => return true
               -- we have squared someting not -1 and got 1
               t = nm1 =>
                   print "leaving"
                   break
            print "check t = -1 after loop"
            not (t = nm1) =>
                print "t = -1 after loop"
                return true
         print "after t = 1 or t = -1"
         false


Type: Void
(3) -> rb(2,41,40,5,3)
   Compiling function rb with type (PositiveInteger,PositiveInteger,
      PositiveInteger,PositiveInteger,PositiveInteger) -> Boolean
   "check j 1"
   "leaving"
   "check t = -1 after loop"
   "after t = 1 or t = -1"

   (3)  false
Type: Boolean
rb(p,n,nm1,q,k) ==
         -- probability n prime is > 3/4 for each iteration
         -- for most n this probability is much greater than 3/4
         t := powmod(p, q, n)
         -- neither of these cases tells us anything
--         if not (one? t or t = nm1) then
         if not ((t = 1) or t = nm1) then
            for j in 1..k-1 repeat
               print(concat("check j ", string(j)$String)::OutputForm)
               oldt := t
               t := mulmod(t, t, n)
--               one? t => return true
               (t = 1) => return true
               -- we have squared someting not -1 and got 1
               t = nm1 =>
                   print "leaving"
                   break
            print "check t = -1 after loop"
            not (t = nm1) => 
                print "t = -1 after loop"
                return true
         print "after t = 1 or t = -1"
         false
)abbrev package RABIN Rabin

Z ==> Integer
Rabin: with
  rabin: (Z, Z, Z, Z, NonNegativeInteger) -> Boolean
 == add
  rabin(p: Z, n: Z, nm1: Z, q: Z, k: NonNegativeInteger): Boolean ==
         -- probability n prime is > 3/4 for each iteration
         -- for most n this probability is much greater than 3/4
         t := powmod(p, q, n)
         -- neither of these cases tells us anything
--         if not (one? t or t = nm1) then
         if not ((t = 1) or t = nm1) then
            for j in 1..k-1 repeat
               print(concat("check j ", string(j)$String)::OutputForm)
               oldt := t
               t := mulmod(t, t, n)
--               one? t => return true
               (t = 1) => return true
               -- we have squared someting not -1 and got 1
               t = nm1 =>
                   print "leaving"
                   break
            print "check t = -1 after loop"
            not (t = nm1) => 
                print "t = -1 after loop"
                return true
         print "after t = 1 or t = -1"
         false
-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.


Reply via email to