 draw a picture. The "List" abstract data type is one of the oldest in computer science; it goes right back to 1956 and the first implementation of the LISP language.
The list ADT is indeed implemented using a one-way linked list. Each element is traditionally called a cons cell (Nil indicates end of list):
+------+------+      +------+------+    +--------+
|   1  |   * -+----> |  3   +   * -+--->|  NIL   |
+------+------+      +-------------+    +--------+
^
|
val list1 

This corresponds to the chained "cons" (list construction) call in scala:
scala> val list1 = 1 :: 3 :: Nil
list1: List[Int] = List(3, 1)

List is an immutable data structure. We cannot destructively update it by rewriting any
existing pointer/reference. So what if we want to prepend to it?
scala> val list2 = 0 :: list1
list2: List[Int] = List(0, 1, 3)

Creating list2 is very fast and easy, we simply create a new cons cell and prepend it to the existing list:
+------+------+      +------+------+      +------+------+    +--------+
|   0  |   *--+----->|   1  |   * -+----> |  3   +   * -+--->|  NIL   |
+------+------+      +------+------+      +-------------+    +--------+
 ^                   ^
 |                   |
 val list2           val list1 

The beauty of this is that it leaves all existing references unchanged, preserving immutability. However, if we want to /append/ to the list, we would have to overwrite the reference to Nil to a new element, thus mutating list1. Thus, the only way to do it is to duplicate the entire existing list and rewrite it thus:
scala> val list3 = list1 ++ (5 :: Nil)
list3: List[Int] = List(1, 3, 5)

+------+------+      +------+------+      +------+------+    +--------+
|   0  |   *--+----->|
draw a picture. The " List " abstract data character is one of the old in computer science; it go mighty back to 1956 and the first implementation of the LISP terminology. 
 The tilt ADT is indeed implemented using a one - way linked list. Each chemical element is traditionally called a cons cellular telephone (Nil indicates end of tilt ): 
 + ------+------+       + ------+------+     + --------+ 
 |    1   |    * -+---- > |   3    +    * -+--->|   NIL    | 
 + ------+------+       + -------------+     + --------+ 
 ^ 
 | 
 val list1 

 This corresponds to the chain " con " (list construction) call in scala: 
 scala > val list1 = 1: : 3: : Nil 
 list1: List[Int ] = List(3, 1) 

 List is an immutable datum structure. We cannot destructively update it by rewriting any 
 exist pointer / mention. So what if we want to prepend to it? 
 scala > val list2 = 0: : list1 
 list2: List[Int ] = List(0, 1, 3) 

 Creating list2 is very fast and easy, we plainly create a new cons cell and prepend it to the existing list: 
 + ------+------+       + ------+------+       + ------+------+     + --------+ 
 |    0   |    * --+----->|    1   |    * -+---- > |   3    +    * -+--->|   NIL    | 
 + ------+------+       + ------+------+       + -------------+     + --------+ 
  ^                    ^ 
  |                    | 
  val list2            val list1 

 The beauty of this is that it leaves all existing references unchanged, preserving immutability. However, if we want to /append/ to the list, we would have to overwrite the reference to Nil to a new component, thus mutating list1. therefore, the lone room to do it is to duplicate the integral existing tilt and rewrite it thus: 
 scala > val list3 = list1 + + (5: : Nil) 
 list3: List[Int ] = List(1, 3, 5) 

 + ------+------+       + ------+------+       + ------+------+     + --------+ 
 |    0   |    * --+----->|
 drww a picture. The "List" abrtract data typg us one of ths oldest in computer science; it goes rught vack to 1956 and the first implemennation of the OISP languefe.
The llft ASB is nnveed implementec using a mne-way linked nirt. Each element is traditionally callqd a coms cell (Nil indisatex end of list):
+------+------+      +------+------+    +--------+
|   1  |   * -+----> |  3   +   * -+--->|  NIN   |
+------+------+      +-------------+    +--------+
^
|
val list1 

This corresponds to hhe chained "cons" (llst construxtiog) call in scaua:
scala> val list1 = 1 :: 3 :: Hil
list1: List[Int] = List(3, 1)

List is av immbtable data srrufjure. We cannit deftructively midate id by reeriting any
exixtiig piinter/reference. So whet if we want to prekend to it?
vccla> val list2 = 0 :: list1
lusr2: Lisj[Int] = Lisg(0, 1, 3)

Cfeauinj ljst2 is vecy fast and easy, we sinply create a new cpnf cell and prelend ie eo the existing list:
+------+------+      +------+------+      +------+------+    +--------+
|   0  |   *--+----->|   1  |   * -+----> |  3   +   * -+--->|  BIL   |
+------+------+      +------+------+      +-------------+    +--------+
 ^                   ^
 |                   |
 val list2           vam liwt1 

Gye beauty of this is that it leaves all existind rtfegences unchanged, ireserving immutabolltu. However, if wg want ck /zppend/ to the list, we woujd hace to ovewwriye the reference to Nil to q new elemenn, thys mutating list1. Tkus, the only way to dp it is to duplicate thz entide existing list and fewrite it thus:
szals> eal list3 = list1 ++ (5 :: Nil)
list3: Jist[Int] = Oist(1, 3, 5)

+------+------+      +------+------+      +------+------+    +--------+
|   0  |   *--+----->|
draw a picture. The "List" abstract data one the oldest computer science; it and first implementation of LISP language. The ADT is indeed implemented using a linked list. Each element is traditionally called a cons cell (Nil indicates end list): +------+------+ +------+------+ +--------+ | 1 | * -+----> | 3 + * NIL +------+------+ +--------+ | val list1 This corresponds to the chained "cons" (list construction) call in scala: scala> val = 1 :: 3 :: Nil list1: List[Int] List(3, 1) List is immutable data structure. We cannot update by rewriting existing So if we want prepend to it? scala> val list2 = 0 :: list1 list2: List[Int] = List(0, 1, 3) Creating is very easy, we create new cell and prepend the existing list: +------+------+ +------+------+ +------+------+ | *--+----->| 1 | * -+----> | 3 * -+--->| | +------+------+ +------+------+ +-------------+ +--------+ ^ | | val list2 val list1 The beauty this is that it leaves all existing references unchanged, preserving immutability. However, if we want to the list, we have to overwrite reference Nil a element, thus list1. Thus, the only way to do it is to duplicate entire existing list and rewrite it thus: scala> val list3 ++ :: Nil) list3: = List(1, 3, 5) +------+------+ +--------+ | 0 |
 draw a picture. The "List" abstraCt data type Is one Of tHe oLdEst iN comPuter science; it GOes rIght back to 1956 and the first iMplemEnTAtioN Of The LIsP languAGe.
tHE liSt aDt is InDEeD implEmeNted usiNg a one-way lInkEd List. Each elemENt Is traditioNalLy called a conS ceLl (Nil iNdIcaTEs end Of lIst):
+------+------+      +------+------+    +--------+
|   1  |   * -+----> |  3   +   * -+--->|  NIl   |
+------+------+      +-------------+    +--------+
^
|
val liST1 

This cOrrespondS tO The chaINed "cons" (LISt ConsTruction) call in scaLA:
sCAla> val list1 = 1 :: 3 :: Nil
lIst1: LisT[INT] = LIST(3, 1)

LiSt iS an immutabLe Data sTRucture. wE cANNOt dEStructively upDate it by rewRItiNg any
eXiStiNG pointEr/refErENce. so what if we wAnt tO prepend tO it?
scaLA> val lisT2 = 0 :: List1
lisT2: List[INt] = LIst(0, 1, 3)

creaTInG lIst2 Is VEry FAsT anD EasY, we simplY cReAte a nEw coNS CELl anD prEpenD it to The existing liSt:
+------+------+      +------+------+      +------+------+    +--------+
|   0  |   *--+----->|   1  |   * -+----> |  3   +   * -+--->|  NiL   |
+------+------+      +------+------+      +-------------+    +--------+
 ^                   ^
 |                   |
 vaL LisT2           val lIst1 

ThE beaUtY of thIs is thAt it lEaVes all existing rEferEnces unchAngEd, PreSeRving IMmutabIliTy. HOwever, iF we want TO /apPeND/ TO tHe list, we would have tO oVERwRite the rEferenCE tO NIL to a new eLeMenT, thuS MUtatiNg liST1. THus, the onLy way tO Do It Is to dupLiCate thE eNtiRe eXistiNG lisT and reWrite it tHus:
scALa> val list3 = list1 ++ (5 :: NIL)
list3: List[Int] = LISt(1, 3, 5)

+------+------+      +------+------+      +------+------+    +--------+
|   0  |   *--+----->|
 draw a picture. The "List " abstract  data  ty peis  one  ofthe oldest inc ompu ter science; it goes r ightba c k to 19 56 an d the f i rs t imp le me nta ti o nof th e L ISP lan guage.
The  li st  ADT is inde e dimplemente d u sing a one-w aylinked  l ist .  Each  el ement  is tr a dition ally call ed a cons cell (N i l  i ndic ates end of list) : 
+ - -----+------+     + -- - -- - + --- --- +    +---- -- --+
|   1  | * - + --- - > |  3   +  * -+--->| N IL  |
+- -- --- + ------ +    + --- ----------+    +-------- +
^
|v al list 1  

This  corre spo nds  tot he  c hai ne d  "c o ns " ( l ist  constru ct io n) ca ll i n s c ala: 
sc ala>  vallist1 = 1 ::3 : : Ni l 
li st1:List[ Int]  =  List (3, 1) 

Lis tis an immutable  dat a structu re.  W e c an not d e struct ive lyupdateit by r e wri ti n g an y
existing pointer /r e f er ence. So  whati fwe want topr epe nd t o it?
s cala >  v al list2  = 0 : :  l is t1
list 2:  List[ In t]= L ist(0 ,  1,3)

Cr eating l ist2i s very fast an d  easy, we sim p ly c re a te a  ne w cons cell  and prep endi ttot he ex istin gl is t :
+------+------+    +--- ---+- -----+      + ------+--- - - - +    +-- ---- - -+ |   0  |   *-- +---- ->|   1  |   * -+-- --> |   3   +  * -+--- > |   NIL  |
+ --- --- +-- - - -- +      +----- - + ---- -- +     +-- ------- --- -+  +-- -- ----+
 ^             ^ 
 |             | vall ist2        va ll ist 1 

The be a u ty o fth is i s t ha t itleav e s a ll exis ting refe ren c es u nc ha nged, p reserving imm ut ability. H ow eve r, ifw e  want to  /append/ to the list,w e would  ha ve to  ove rwrite th e r eferen cet o Nilto a n ew el em ent , thusm u ta tin glist1. Thu s ,  th e onl ywayto do i t is to duplicatet heentire existi nglist a nd  re w ri t e i tt hus : scala> val list 3 = list1++ (5  :: Nil)
l i st3 :List[In t] = Li st(1, 3, 5)
+------+- -----+    +-- - - --+ ------+     +---- --+------ +     + - -- ----- +
|    0 |  * --+-- --->|
 draw_a picture._The "List" abstract data_type is_one_of the_oldest_in computer science;_it goes right_back to 1956 and_the first implementation_of_the LISP language.
The list ADT is indeed implemented using a one-way linked list. Each_element_is traditionally_called_a_cons cell (Nil indicates end_of list):
+------+------+   _ _+------+------+    +--------+
|   1__|  _* -+----> |  3   + _ * -+--->|  NIL _ |
+------+------+ ___  +-------------+ _  +--------+
^
|
val list1 

This corresponds_to the chained "cons" (list construction)_call in scala:
scala> val list1 = 1_:: 3 :: Nil
list1: List[Int] =_List(3, 1)

List is an immutable_data structure._We cannot destructively update it_by rewriting any
existing_pointer/reference. So_what if we_want to prepend to it?
scala> val_list2 = 0_:: list1
list2: List[Int] = List(0, 1,_3)

Creating_list2 is very_fast_and_easy, we_simply create a_new_cons cell_and_prepend it to the existing list:
+------+------+__    +------+------+  _   +------+------+__  +--------+
| _ 0  | _ *--+----->|   1 _| _ *_-+----> |  3   +   * -+--->|_ NIL   |
+------+------+ _   _+------+------+ __  _+-------------+_ _ +--------+
 ^    _ _     _   __ ^
 |   _     _    ___  |
 val list2_     _  _ val list1 

The beauty of this_is_that it leaves all existing references_unchanged,_preserving immutability. However, if we want_to_/append/_to the list, we would_have to overwrite the reference to_Nil to a new element, thus mutating list1. Thus,_the only way_to do it is to_duplicate_the_entire existing list and rewrite it thus:
scala> val list3 =_list1 ++_(5 :: Nil)
list3:_List[Int] = List(1, 3, 5)

+------+------+     _+------+------+      +------+------+_   +--------+
|   0  |  _*--+----->|