<commit_before>;;;;; Transpiler: TRE to JavaScript
;;;;; Copyright (c) 2008-2010 <NAME> <<EMAIL>>

(dont-obfuscate length)

(defun length (x)
  (when x
    (if (consp x)
	    (%list-length x)
	    x.length)))

(defun maparray (fun hash)
  (dotimes (i (length hash))
    (funcall fun (aref hash i))))

(defun maphash (fun hash)
  (dolist (i (%property-list hash))
    (funcall fun i. .i)))

(defun elt (seq idx)
  (if
    (stringp seq)
	  (%elt-string seq idx)<commit_msg>LENGTH: Return 0 for NIL.<commit_after>;;;;; Transpiler: TRE to JavaScript
;;;;; Copyright (c) 2008-2010 <NAME> <<EMAIL>>

(dont-obfuscate length)

(defun length (x)
  (if x
      (if (consp x)
	      (%list-length x)
	      x.length)
      0))

(defun maparray (fun hash)
  (dotimes (i (length hash))
    (funcall fun (aref hash i))))

(defun maphash (fun hash)
  (dolist (i (%property-list hash))
    (funcall fun i. .i)))

(defun elt (seq idx)
  (if
    (stringp seq)
	  (%elt-string seq idx)
{'fraction_non_alphanumeric': 0.16977225672877846, 'fraction_numerical': 0.018633540372670808, 'mean_word_length': 3.1148936170212767, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3751004', 'n_tokens_mistral': 406, 'n_tokens_neox': 379, 'n_words': 120}