statistics utilities #281

Parent #72Owner #361Flags readSource hellcore/hellcore.db

Aliases: statistics utilities, stats utils, stu

2 verbs · 11 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
medianthis none thisrxd#28112
median_suspendedthis none thisrxd#28112

Properties

PropertyDefinerFlagsOwnerValue
help_msg#72rc#361
list of 6{"$stats_utils ($stu) provides verbs for statistical analysis.", "", "or it will, someday. currently there is one verb:", " :median(LIST) -> FLOAT median.", "", "It is also available in suspending form as :median_suspended."}
aliases#1rc#361{"statistics utilities", "stats utils", "stu"}
description#1rc#361<clear>
object_size#1r#29{1709, 1298434487}
hidden_verbs#1rc#361<clear>
phelp_msg#1rc#361<clear>
weight#1rc#361<clear>
owner_verbs#1rc#361<clear>
plural_name#1rc#361<clear>
client_image#1rc#361<clear>
listening#1rc#361<clear>

Ancestry

Ancestors (nearest first): #72 Generic Utilities Package#1 root

Children: none

Call graph

calls n281_0 #281:median n47_14 #47:sort n281_0->n47_14 n281_1 #281:median_suspended n47_15 #47:sort_suspended n281_1->n47_15

Source

median

Spec this none thisFlags rxdOwner #361Definer #281

Referenced by

none

Source

1":median(LIST floats_or_ints) => FLOAT median";
2{l} = args;
3if (typeof(l) != LIST)
4raise(E_INVARG, "argument 1 must be list");
5endif
6l = $lu:sort(l);
7n = length(l);
8if ((n % 2) == 0)
9return (tofloat(l[(n / 2) + 1]) + tofloat(l[n / 2])) / 2.0;
10else
11return tofloat(l[(n / 2) + 1]);
12endif

median_suspended

Spec this none thisFlags rxdOwner #361Definer #281

Referenced by

none

Source

1":median(LIST floats_or_ints) => FLOAT median";
2{l} = args;
3if (typeof(l) != LIST)
4raise(E_INVARG, "argument 1 must be list");
5endif
6l = $lu:sort_suspended(l);
7n = length(l);
8if ((n % 2) == 0)
9return (tofloat(l[(n / 2) + 1]) + tofloat(l[n / 2])) / 2.0;
10else
11return tofloat(l[(n / 2) + 1]);
12endif