axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] undocument "pattern matching" operator in Axiom interp


From: Bill Page
Subject: [Axiom-developer] undocument "pattern matching" operator in Axiom interpreter
Date: Tue, 2 Jan 2007 21:59:50 -0500

I have not been able to find any documentation about the use
of "is" in the Axiom interpreter. For example:

(1) -> [1,2,3] is [a,b,c]

   (1)  true
                                  Type: Boolean
(2) -> a

   (2)  1
                                  Type: PositiveInteger
(3) -> b

   (3)  2
                                  Type: PositiveInteger
(4) -> c

   (4)  3
                                  Type: PositiveInteger
(5) -> [1,2,3] is [x,y]

   (5)  false
                                  Type: Boolean
(6) -> x

   (6)  x
                                  Type: Variable x
(7) -> y

   (7)  y
                                  Type: Variable y
(8) -> [x,y] is [1,2]

   Pattern matching is only allowed on lists.

(9) -> )di op is
   is is not a known function. AXIOM will try to list its functions
      which contain is in their names. This is the same output you
      would get by issuing
                             )what operations is

(10) -> [[1,2],[3,4]] is [p,q]

   (10)  true
                                  Type: Boolean
(11) -> p,q

   (11)  [[1,2],[3,4]]
                                  Type: Tuple List PositiveInteger
(12) -> p

   (12)  [1,2]
                                  Type: List PositiveInteger
(13) -> [[1,2],[3,4]] is [[p1,p2],[q1,q2]]

   (13)  true
                                  Type: Boolean
(14) -> p1

   (14)  1
                                  Type: PositiveInteger
(15) -> [[1,2],[3,4]] is [[x1,x2],y0]

   (15)  true
                                  Type: Boolean
(16) -> y0

   (16)  [3,4]
                                  Type: List PositiveInteger
(17) -> ...

Does anyone know where I can find out how to use "is" in the
interpreter? Where is this defined in the the interpreter source
code? Is this operator also defined in the SPAD language?

Regards,
Bill Page.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]