<commit_before>function ntrprt(program) {
  var ops = ['+', '*', '-', '/', '%', '^', '|', '&', '||', '&&', '<', '>', '<<', '>>']
  var dup = function(stack) {return stack.concat(stack[stack.length-1])}
  
  return program.reduce(function(stack, word) {
    if(+word == word) return stack.concat(word)                  // numbers go on the stack
    if(~ops.indexOf(word))
      stack.push(eval(stack.pop() + word + stack.pop()))         // ops are all binary
    else 
      stack = eval(word+'('+JSON.stringify(stack)+')')           // funs are binary too
    return stack
  }, [])
}

function parse(str) {
  return str.split(/\s+/)
}

function f(str) {
  return ntrprt(parse(str))
}

// f('1.12332 2 3 + 4 7 % ^ *')<commit_msg>fancier code structure and logging<commit_after>function f_two(str) {
  return ntrprt(parse(str))

  function ntrprt(program) {
    var ops = ['+', '*', '-', '/', '%', '^', '|', '&', '||', '&&', '<', '>', '<<', '>>']
    var dup = function(stack) {return stack.concat(stack[stack.length-1])}
  
    return program.reduce(function(stack, word) {
      if(+word == word) return stack.concat(word)                  // numbers go on the stack
      if(~ops.indexOf(word))
        stack.push(eval(stack.pop() + word + stack.pop()))         // ops are all binary
      else 
        stack = eval(word+'('+JSON.stringify(stack)+')')           // funs are binary too
      return stack
    }, [])
  }

  function parse(str) {
    return str.split(/\s+/)
  }
}


var str, name = 'f_two'
console.log(i = name+'("2 3 +")', eval(i))
console.log(i = name+'f_one("2 3 + 4 7 % ^")', eval(i))
console.log('f_one("1.12332 2 3 + 4 7 % ^ *")', eval(i))
{'fraction_non_alphanumeric': 0.22984356197352587, 'fraction_numerical': 0.01684717208182912, 'mean_word_length': 2.7286995515695067, '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': '1701985', 'n_tokens_mistral': 618, 'n_tokens_neox': 594, 'n_words': 121}