vle-subst-nth

Parent Previous Next

vle-subst-nth


(vle-subst-nth  lst  idx  val)

sets / replaces the item at index 'idx' in list 'lst' with specified new value 'val'

Arguments

'lst'  input list where the item at position 'idx' is to be set
'idx'  the index of the item to be replaced by new 'val'
'val'  the new value to be set for the item

Return

list 'lst' without item at position 'idx';
if there is no item 'idx' in 'lst' the list remains unchanged;
if 'idx' is < 0 or greater than the list length, the unchanged list is returned

Example

(vle-subst-nth '(1 2 3 4 5) 2 99)    => '(1 2 99 4 5)
(vle-subst-nth '(1 2 3 4 5) 10 99)  => '(1 2 3 4 5)

Alias

vle-replace

Remarks

index 'idx' is 0-based




©  Menhirs NV. All rights reserved.