> ?
> rempart(e, n) := block(
>? ? [p, q, left, right, v: aux2(e), m],
>? ? m: length(v),
>? ? if listp(n) then [p, q]: n else p: q: n,
>? ? if p = 1 then left: [] else left: rest(v, -m + p - 1),
>? ? if q = m then right: [] else right: rest(v, q),
>? ? if p = 1 and q = m then right: rest(e, q) else aux1(e, left, right))$
>?
?
?
Since we convert to a list, the 2nd and the 3rd "if" are not necessary:
?
rempart(e, n) := block(
?? [p, q, v: aux2(e), m],
?? if listp(n) then [p, q]: n else p: q: n,
?? if q = (m: length(v)) and p = 1 then rest(e, q) else aux1(e, rest(v, -m + p - 1), rest(v, q)))$
?
?