<commit_before>'''Term unifying transformations.'''


from transf import transformation
from transf.lib import base
from transf.lib import util
from transf.lib import combine
from transf.lib import match
from transf.lib import build
from transf.lib import project
from transf.lib import arith


def Foldr(tail, Cons, operand=None):
	if operand is None:
		operand = base.ident
	foldr = util.Proxy()
	foldr.subject = \
		match.nil * tail + \
		Cons(
			project.head * operand,
			project.tail * foldr
		)
	return foldr


def _CountOne(operand):
	return combine.GuardedChoice(operand, build.one, build.zero)


def Count(operand):
	'''Count the number of occorrences in a list.'''
	return Foldr(<commit_msg>Use guarded choice in Foldr.<commit_after>'''Term unifying transformations.'''


from transf import transformation
from transf.lib import base
from transf.lib import util
from transf.lib import combine
from transf.lib import match
from transf.lib import build
from transf.lib import project
from transf.lib import arith


def Foldr(tail, Cons, operand=None):
	if operand is None:
		operand = base.ident
	foldr = util.Proxy()
	foldr.subject = combine.GuardedChoice(
		match.nil, tail,
		Cons(
			project.head * operand,
			project.tail * foldr
		)
	)
	return foldr


def _CountOne(operand):
	return combine.GuardedChoice(operand, build.one, build.zero)


def Count(operand):
	'''Count the number of occorrences in a list.'''
	return Foldr(
{'fraction_non_alphanumeric': 0.0916030534351145, 'fraction_numerical': 0.0, 'mean_word_length': 4.340740740740741, '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': '616216', 'n_tokens_mistral': 489, 'n_tokens_neox': 443, 'n_words': 154}