lib for developers : libList
|
10-08-2016, 09:37 PM
(This post was last modified: 09-17-2017 03:06 PM by primer.)
Post: #1
|
|||
|
|||
lib for developers : libList
Hello,
The hpprime provide already many usefull list functions, mostly for math, But I'm sharing with you my libList v1 that provide some basic list functions for programming. LibList.hpprgm (Size: 5.05 KB / Downloads: 34) see next post for version 2. API list : L_GET, L_SET, L_INS, L_DEL, L_MAP, ARR2LST and LST2VECT L_INS(lst,pos,item) Insert an item to a list. Retruns the new list if pos is null, insert at the end if pos<0, count -pos from right to insert at ex : Code: L_INS({11,22,33},1, 99); // returns {99,11,22,33} L_SET(lst,pos,item) Set (change) an item from a list. Retruns the new list. note : it does not add item, list size does not increase if pos is null, change the last item if pos<0, count -pos from right to change ex : Code: L_SET({11,22,33},1, 99); // returns {99,22,33} L_DEL(lst,pos) Remove an item from a list. Returns the new list if pos is null, remove the last item if pos<0, remove by counting -pos from the right ex : Code: L_DEL({11,22,33},1); // returns {22,33} L_GET(lst,pos) Get an item from a list. Returns the item if pos is null, get last item if pos<0, count -pos from right if pos exceed list size, return last ex : Code: L_GET({11,22,33,44},2); // returns 22 L_MAP(lst,userfunction) Call a function on each list item. Returns the list of function returns ex : Code: EXPORT myfct(a) // a userfunction ARR2LST(array) Convert vector or matrix to list resulting list have embeded lists in case of matrix ex : Code: ARR2LST([1,2,3]); // returns {1,2,3} LST2VECT(lst) Convert a simple list to a vector note : list items must be numbers ex : Code: LST2VECT({1,2,3}); // returns [1,2,3] primer |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
lib for developers : libList - primer - 10-08-2016 09:37 PM
RE: lib for developers : libList - primer - 10-16-2016, 09:46 AM
RE: lib for developers : libList - Guenter Schink - 10-16-2016, 07:46 PM
RE: lib for developers : libList - primer - 09-17-2017, 05:10 PM
RE: lib for developers : libList - StephenG1CMZ - 10-02-2017, 09:02 PM
|
User(s) browsing this thread: 1 Guest(s)