You could do this...
listheader: ?car([])$
f(k,r,s):=block([simp:off],?cons (listheader,?subseq(?cdr(k),r,s)));
f([0,1,2,3,4,5,6,7], 2, 6)
--> [2,3,4,5]
This does no error checking, and also it would be shorter to
just write it in lisp.
(defun $f(k r s) (cons '(mlist) (subseq (cdr k) r s)))
to do this right you might wish to check that r,s are integers
such that 0<=r<=s<= length of k.
Gottfried Helms wrote:
> Hi -
>
> new to maxima-list, and I did not find this in the 2003-archive:
> I have a list, created by a cf(x)-function-call.
> I want to use only the first n-entries of the list.
> In some matrix-languages you write something like
>
> y := x(1..n) or
> y = x[1:n] or something like.
>
> Is that possible in maxima too?
>
> thanks -
>
> Gottfried Helms
> Uni Kassel
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima