Created
February 4, 2012 15:08
-
-
Save yfyf/1738397 to your computer and use it in GitHub Desktop.
motivation for the extended integers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Return = case NumberGrouping of | |
default -> | |
Nums = [Nr || {Nr, _} <- ctree:get_nr(ResultTree, [{count, Limit}])], | |
Sublist = case Limit of | |
infinity -> | |
Numbers; | |
L when is_integer(L) -> | |
lists:sublist(number_utils:expand_list(Nums), Limit) | |
end, | |
number_utils:reduce_list(Sublist). | |
aligned -> | |
Blocks = [Nr || {Nr, _} <- ctree:get_nr(ResultTree, | |
[{type, blocks}, {count, Limit}])], | |
BlockNumCount = number_utils:count_list(Blocks), | |
case Limit /= infinty andalso BlockNumCount >= Limit of | |
true -> | |
reduce_blocks_to_limit(Blocks, Limit); | |
false -> | |
Sparse = [Nr || {Nr, _} <- ctree:get_nr(ResultTree, [ | |
{type, sparsed}, | |
{count, (case Limit of | |
infinity -> | |
infinity; | |
_ -> | |
Limit - BlockNumCount | |
end)} | |
])], | |
lists:append(Blocks, Sparse) | |
end; | |
<..> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment