I grew up with MATLAB, where extracting a subset of a vector V was easy as feeding a vector of indices into a vector. For example entries i thru j could be had with** V(i:j)** and an more complicated index scheme could be accomplished with a vector of indices i_index and then **V(i_index).**

In Maxima, **first()**, **last()**,** firstn()**, **rest()**, and most generally **makelist()** allows for all that and more but with a little more cumbersome calling protocols. Here are one-liners that achieve something like the two canonical MATLAB examples above:

Advertisements