Logo

Programming-Idioms

History of Idiom 44 > diff from v22 to v23

Edit summary for version 23 by :
New Erlang implementation by user [elbrujohalcon]

Version 22

2015-11-30, 12:37:28

Version 23

2016-01-26, 02:29:31

Idiom #44 Insert element in list

Insert element x at position i in list s. Further elements must be shifted to the right.

Idiom #44 Insert element in list

Insert element x at position i in list s. Further elements must be shifted to the right.

Code
{Left, Right} = lists:split(I-1, S),
Left ++ [X|Right].
Demo URL
http://tryerl.seriyps.ru/#id=0ff3