beautypg.com

List manipulations, List manipulations -7 – HP 49g Graphing Calculator User Manual

Page 90

Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

background image

List Manipulations

The following functions provide ways to manipulate the elements of a list:

Function

Description

Q (MTHl

LIST SORT

Sorts the elements in a list in ascending order. In RPN
mode, the list must be on level 1.

0 (MÌB)

LIST EEVLIST

Reverses the order of the elements in a list. In RPN
mode, the list must be on level 1.

0

(PRGI

l

IST ELEMENTS

HEAD

Returns the first element in the list. In RPN mode, the

list must be on level 1.

0

(@G)

list

elements

tail

Returns a list of all the elements in the list except the

first element. In RPN mode, the list must be on

level 1.

0 (re)

LIST ELEMENTS GET

Returns the element in the list (argument 1/level 2) cor­

responding to a specified position (argument 2/leveI 1).
For example, GET({ 1 , 4 , 7 , 8 } , 3) returns 7, since 7 is

the third element in the list.

0

(ire) LIST ELEMENTS GETI

Similar to the GET command (see above) but also

returns the specified position number incremented by 1

(and the original list). For example, GETI({ 1 , 4 , 7 , 8 } ,
3) returns

{

1, 4, 7, 8}, 4 (the specified position number

+

1), and 7 (the third element in the list).

0 (re)

LIST ELEMENTS PUT

Replaces an element at a particular position (argument
2/level 2) of a list (argument 1/level 3), with a new ele­
ment (argument 3/level 1). For example,

PUT({

1, 2, 3),

2, 5) returns

{

1, 5, 3}.

0

(00

LIST ELEMENTS PUTÌ

Similar to the

PUT

command (see above) but also

returns the specified position number incremented by 1.
For example,

PUTI({

1, 2, 3), 2, 5) returns

{{

1, 5, 3},

3}.

0

(00

LIST ELEMENTS SIZE

Returns the number of elements in a list. In RPN mode,
the list must be on level 1.

Lists and Sequences

Page 9-7