<commit_before>/* vim:set ts=2 sw=2 sts=2 expandtab */
/*jshint asi: true undef: true es5: true node: true browser: true devel: true
         forin: true latedef: false globalstrict: true */
'use strict';

var sequence = require('./sequence'),
    isEmpty = sequence.isEmpty, count = sequence.count,
    first = sequence.first, rest = sequence.rest,
    cons = sequence.cons, make = sequence.make, empty = sequence.empty

function List() {}
List.prototype.length = 0
List.prototype.toString = function() {
  var value = '', tail = this;
  while (!isEmpty(tail)) {
    value = value + ' ' + first(tail)
    tail = rest(tail)
  }

  return '(' + value.substr(1) + ')'
}

count.define(List, function(list) { return list.length })
first.define(List, function(list) { return list.head })
rest.define(List, function(list) { return list.tail })
make.define(List, function(tail, head) { return new List(head, tail) })

function list() {
  var items = arguments, count = items.length, tail = empty
  while (count--) tail = cons(items[count], tail)
  return tail
}
exports.list = list<commit_msg>Change `List` so that it sets it's head, tail and `length` properties & export it from module.<commit_after>/* vim:set ts=2 sw=2 sts=2 expandtab */
/*jshint asi: true undef: true es5: true node: true browser: true devel: true
         forin: true latedef: false globalstrict: true */
'use strict';

var sequence = require('./sequence'),
    isEmpty = sequence.isEmpty, count = sequence.count,
    first = sequence.first, rest = sequence.rest,
    cons = sequence.cons, make = sequence.make, empty = sequence.empty

function List(head, tail) {
  this.head = head
  this.tail = tail || empty
  this.length = count(tail) + 1
}
List.prototype.length = 0
List.prototype.toString = function() {
  var value = '', tail = this;
  while (!isEmpty(tail)) {
    value = value + ' ' + first(tail)
    tail = rest(tail)
  }

  return '(' + value.substr(1) + ')'
}
exports.List = List

count.define(List, function(list) { return list.length })
first.define(List, function(list) { return list.head })
rest.define(List, function(list) { return list.tail })
make.define(List, function(tail, head) { return new List(head, tail) })

function list() {
  var items = arguments, count = items.length, tail = empty
  while (count--) tail = cons(items[count], tail)
  return tail
}
exports.list = list
{'fraction_non_alphanumeric': 0.14811680067710536, 'fraction_numerical': 0.005501481168006771, 'mean_word_length': 3.8442622950819674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4947239', 'n_tokens_mistral': 749, 'n_tokens_neox': 740, 'n_words': 225}