vle-sublist

Parent Previous Next

vle-sublist


(vle-sublist  lst  startidx  nritems)

creates a sublist from given input list 'lst', starting with item at index 'startidx' and of maximum 'nritems' number of list items from 'lst'

Arguments

'lst'       list to extract a sublist from
'startidx'  index of first item for sublist (0-based); if 'startidx' is < 0, 0 is used
'nritems'   number of items to be copied from 'lst' list;
                  if 'nritems' is < 0, all items after 'startidx' are copied to result list

Return

a sublist of 'lst' starting with index 'startidx' and containing 'nritems' of input list 'lst';
if 'lst' has not enough items, only the items of 'lst' are copied to result list, no NIL is appended

Example

(vle-sublist '(1 2 3 4 5 6 7) 2 3)  => '(3 4 5)
(vle-sublist '(1 2 3 4 5 6 7) 2 -1) => '(3 4 5 6 7)
(vle-sublist '(1 2 3 4 5 6 7) 2 10) => '(3 4 5 6 7)

Alias


Remarks

index is 0-based




©  Menhirs NV. All rights reserved.