<?php

function fn_avg_t($aql)
{
	$list = $aql->Consume(1);

	$ttl = 0;
	$cnt = 0;
	foreach($list[0]->value as $p)
	{		
		if ($p->rawvalue != "^")
		{
			$cnt++;
			$ttl += $p->rawvalue;
		}
	}
	
	$a = new AQLStackElement();
	$a->typename = "const";
	$a->islist = true;
	$a->value = $ttl / $cnt;
	array_push($aql->stack,$a);
}

?>