<commit_before>###*
  @fileoverview Contains the implementation of the List data structure.
  @author <NAME> (<EMAIL>)
### 
if require?
  Option   = require './option'
  Some     = Option.Some
  None     = Option.None

###*
  <p>List provides the implementation of the abstract data type 'List' based on a Singly-Linked list</p>
  
  The operations specific to the List abstract data type 

  append( element )             O(n)
  prepend( element )            O(1)
  update( index, element )      O(n)
  get( index )                  O(n)
  remove( index )               O(n)
  
  @class List provides the implementation of the abstract data type 'List' based on a Singly-Linked list <br />
  @public
###
List = (elements...) ->
  
  [x,xs...] = elements    
  if (x == undefined or (x instanceof Array and x.length == 0))
    return new Nil()
  if (x instanceof Array) 
    [hd, tl...] = x
    this.head = hd
    this.tail = new List(tl)
  else 
    this.head = x
    this.tail = new List(xs) 
  
  ###*
    Helper method to construct a list from a value and another list 
    
    @private
  ###
  cons = (head, tail) ->
    l = new List(head)
    l.tail = tail
    return l
  
  this.isEmpty = () -> false 

  ###*
    Create a new list by appending this value
  ###<commit_msg>documentation<commit_after>###*
  @fileoverview Contains the implementation of the List abstract data type.
  @author <NAME> (<EMAIL>)
### 
if require?
  Option   = require './option'
  Some     = Option.Some
  None     = Option.None

###*
  List provides the implementation of the abstract data type List based on a Singly-Linked list. The 
  list contains the following operations:
  
  --------------------------------------------------------
  Core operations of the List ADT 
  --------------------------------------------------------
  append( element )                                   O(n)
  prepend( element )                                  O(1)
  update( index, element )                            O(n)
  get( index )                                        O(n)
  remove( index )                                     O(n)
  --------------------------------------------------------
  Methods that all containers have to implement 
  --------------------------------------------------------
  map( f )                                            O(n)    TODO
  flatMap( f )                                        O(n)    TODO
  filter( f )                                         O(n)    TODO
  forEach( f )                                        O(n)    TODO
  foldLeft( f )                                       O(n)    
  isEmpty()                                           O(1)
  --------------------------------------------------------
  
  @class List provides the implementation of the abstract data type List based on a Singly-Linked list
  @public
###
List = (elements...) ->
  
  [x,xs...] = elements    
  if (x == undefined or (x instanceof Array and x.length == 0))
    return new Nil()
  if (x instanceof Array) 
    [hd, tl...] = x
    this.head = hd
    this.tail = new List(tl)
  else 
    this.head = x
    this.tail = new List(xs) 
  
  ###*
    Helper method to construct a list from a value and another list 
    
    @private
  ###
  cons = (head, tail) ->
    l = new List(head)
    l.tail = tail
    return l
  
  this.isEmpty = () -> false 

  ###*
    Create a new list by appending this value
  ###
{'fraction_non_alphanumeric': 0.17505854800936768, 'fraction_numerical': 0.0014637002341920376, 'mean_word_length': 1.236256544502618, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 17, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '456988', 'n_tokens_mistral': 927, 'n_tokens_neox': 890, 'n_words': 327}