login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #185 append vs concat revision 1 of 3

1 2 3
Editor:
Time: 2007/11/17 22:04:33 GMT-8
Note:

changed:
-
The append function in axiom has the lisp background.  
axiom and lisp don't duplicate the last list.

\begin{axiom}
L1 := [1,2,3] ;
L2 := [10,11,12] ; 
L := append (L1, L2) ; 
L2.2 := 100 
L.5 -- is 100, not 11
\end{axiom}

There is also a concat function that I understand in a mathematical way.
today concat works as append.

\begin{axiom}
L1 := [1,2,3];
L2 := [10,11,12] ; 
Lc := concat (L1, L2) 
L1.2 :=20
Lc.2
L2.2 :=30
Lc.5
\end{axiom}

Lc doesn't change if I change L1, and Lc change if I modify L2.
Is it possible to change concat in order to copy L2, as 
concat (L1, L2) == append (L1, copy (L2))

The concat function becomes just a little slower.
And then list are here a real hi-level n-uple oblject, not a lisp object.
 
F.Maltey

Submitted by : (unknown) at: 2007-11-17T22:04:33-08:00 (17 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

The append function in axiom has the lisp background. axiom and lisp don't duplicate the last list.

axiom
L1 := [1,2,3] ;
Type: List(PositiveInteger?)
axiom
L2 := [10,11,12] ;
Type: List(PositiveInteger?)
axiom
L := append (L1, L2) ;
Type: List(PositiveInteger?)
axiom
L2.2 := 100

\label{eq1}100(1)
Type: PositiveInteger?
axiom
L.5 -- is 100, not 11

\label{eq2}100(2)
Type: PositiveInteger?

There is also a concat function that I understand in a mathematical way. today concat works as append.

axiom
L1 := [1,2,3];
Type: List(PositiveInteger?)
axiom
L2 := [10,11,12] ;
Type: List(PositiveInteger?)
axiom
Lc := concat (L1, L2)

\label{eq3}\left[ 1, \: 2, \: 3, \:{10}, \:{11}, \:{12}\right](3)
Type: List(PositiveInteger?)
axiom
L1.2 :=20

\label{eq4}20(4)
Type: PositiveInteger?
axiom
Lc.2

\label{eq5}2(5)
Type: PositiveInteger?
axiom
L2.2 :=30

\label{eq6}30(6)
Type: PositiveInteger?
axiom
Lc.5

\label{eq7}30(7)
Type: PositiveInteger?

Lc doesn't change if I change L1, and Lc change if I modify L2. Is it possible to change concat in order to copy L2, as concat (L1, L2) == append (L1, copy (L2))

The concat function becomes just a little slower. And then list are here a real hi-level n-uple oblject, not a lisp object.

F.Maltey