<commit_before>var n = require("../lib/index");
var c = require("fastintcompression");
const ups = require("./mine/ups");

var env = ups.create_env(__dirname + "\\test.db");
var db = ups.create_db(env,1);

var ref = require("ref");
var l3 = n.toL3(n.parse(`<persoon id="243">
  <voornaam>Wouter</voornaam>
  <achternaam>Hager</achternaam>
  <beroep>programmeur</beroep>
</persoon>`));

console.log(c.compress(l3));<commit_msg>updated l3+eval test<commit_after>var n = require("../lib/index");

n.frame = (args, closure) => {
	const stack = args.slice(0);
	stack.unshift(args[0]);
	if(closure) {
		for(const k in closure._stack) {
			if(k.charCodeAt(0) < 58) continue;
			stack[k] = closure._stack[k];
		}
	}
	const f = function (...a) {
		const l = a.length;
		if (a == 0) return f;
		const key = a[0];
		if (l == 1) {
			//console.log(key,args);
			return stack[key];
		} else {
			if (l == 2) {
				if(/\./.test(key)) {
					const parts = key.split(".");
					stack.$modules[parts[0]][parts[1]] = a[1];
				} else {
					stack[key] = a[1];
				}
			} else {
				//types[key] = a[1];
				if(/\./.test(key)) {
					const parts = key.split(".");
					stack.$modules[parts[0]][parts[1]] = a[1];
				} else {
					stack[key] = a[2];
				}
			}
			//return f;
		}
	};
	f._stack = stack;
	//f._types = types;
	return f;
};

var $ = n.frame([]);
n.quoteTyped = ($typesig,$lambda) => {
	// ignore type for now
	//console.log($typesig);
	return $lambda;
};

n.item = a => a;
n.function = a => a;
n.occurs = a => a;
//config.$ = $;

const json = n.from([14,"fold-left",14,"to",12,"1",12,"10",17,12,"0",14,"quote-typed",14,"function",14,"",14,"item",17,14,"item",17,17,14,"item",17,17,15,14,"$",3,"acc",14,"$",12,"1",17,17,14,"$",3,"x",14,"$",12,"2",17,17,14,"add",14,"$",3,"acc",17,14,"$",3,"x",17,17,17,17,17]);

n.toJS(n.fromL3Stream(json,NaN))
	.concatMap(x => eval(x.text))
	.subscribe(x => console.log(x));
{'fraction_non_alphanumeric': 0.26393270241850686, 'fraction_numerical': 0.0583596214511041, 'mean_word_length': 3.6189320388349513, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 18, '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': '5466604', 'n_tokens_mistral': 932, 'n_tokens_neox': 813, 'n_words': 132}