| 497 | | values, then C<min> returns a same-typed C<Maybe> with zero elements. Note |
| 498 | | that, while C<min> could conceivably have been defined instead to not |
| 499 | | return a C<Maybe>, but rather to return the appropriate ordinal type's |
| 500 | | concept of negative infinity, this option is avoided for now citing |
| 501 | | practical concerns in the face of infinite (especially non-numeric) types. |
| | 504 | values, then C<min> results in a same-typed C<Maybe> with zero elements. |
| | 505 | I<Note that, while C<min> could conceivably have been defined instead to |
| | 506 | not result in a C<Maybe>, but rather to result in the appropriate ordinal |
| | 507 | type's concept of negative infinity, this option is avoided for now citing |
| | 508 | practical concerns in the face of infinite (especially non-numeric) types.> |
| 652 | | =item C<sys.rtn.Int.Int_from_Text.2 of Int (RO: Text $text)> |
| 653 | | |
| 654 | | This selector function results in the C<Int> value that its argument maps |
| 655 | | to when the whole character string is evaluated as a base-2 integer. |
| 656 | | |
| 657 | | =item C<sys.rtn.Int.Text_from_Int.2 of Text (RO: Int $int)> |
| 658 | | |
| 659 | | This selector function results in the C<Text> value where its argument is |
| 660 | | formatted as a base-2 integer. |
| 661 | | |
| 662 | | =item C<sys.rtn.Int.Int_from_Text.8 of Int (RO: Text $text)> |
| 663 | | |
| 664 | | Same as C<Int.Int_from_Text.2> but for base-8. |
| 665 | | |
| 666 | | =item C<sys.rtn.Int.Text_from_Int.8 of Text (RO: Int $int)> |
| 667 | | |
| 668 | | Same as C<Int.Text_from_Int.2> but for base-8. |
| 669 | | |
| 670 | | =item C<sys.rtn.Int.Int_from_Text.10 of Int (RO: Text $text)> |
| 671 | | |
| 672 | | Same as C<Int.Int_from_Text.2> but for base-10. |
| 673 | | |
| 674 | | =item C<sys.rtn.Int.Text_from_Int.10 of Text (RO: Int $int)> |
| 675 | | |
| 676 | | Same as C<Int.Text_from_Int.2> but for base-10. |
| 677 | | |
| 678 | | =item C<sys.rtn.Int.Int_from_Text.16 of Int (RO: Text $text)> |
| 679 | | |
| 680 | | Same as C<Int.Int_from_Text.2> but for base-16. |
| 681 | | |
| 682 | | =item C<sys.rtn.Int.Text_from_Int.16 of Text (RO: Int $int)> |
| 683 | | |
| 684 | | Same as C<Int.Text_from_Int.2> but for base-16. |
| 685 | | |
| 686 | | =back |
| 687 | | |
| 688 | | =head2 Functions for sys.rtn.Blob |
| | 662 | =item C<sys.rtn.Int.Int_from_Text of Int (RO: NEText $text, PInt2_36 |
| | 663 | $radix)> |
| | 664 | |
| | 665 | This selector function results in the C<Int> value that its C<$text> |
| | 666 | argument maps to when the whole character string is evaluated as a |
| | 667 | base-C<$radix> integer. Extending the typical formats of [base-2, base-8, |
| | 668 | base-10, base-16], this function supports base-2 through base-36; to get |
| | 669 | the latter, the characters 0-9 and A-Z represent values in 0-35. This |
| | 670 | function throws an exception if C<$text> can't be mapped as specified. |
| | 671 | |
| | 672 | =item C<sys.rtn.Int.Text_from_Int of NEText (RO: Int $int, PInt2_36 |
| | 673 | $radix)> |
| | 674 | |
| | 675 | This selector function results in the C<Text> value where its C<$int> |
| | 676 | argument is formatted as a base-C<$radix> integer. |
| | 677 | |
| | 678 | =back |
| | 679 | |
| | 680 | These functions convert between C<Int> values and canonically formatted |
| | 681 | representations of integers as binary strings. I<Conjecture: These may not |
| | 682 | actually be useful, and perhaps only operators that take an argument |
| | 683 | specifying a fixed-length field size, with big and little endian versions, |
| | 684 | would be appropriate instead. Or maybe both kinds are necessary.> |
| | 685 | |
| | 686 | =over |
| | 687 | |
| | 688 | =item C<sys.rtn.Int.Int_from_Blob_S_VBE of Int (RO: NEBlob $blob)> |
| | 689 | |
| | 690 | This selector function results in the C<Int> value that its C<$blob> |
| | 691 | argument maps to when the whole bit string is treated literally as a |
| | 692 | variable-length binary (two's complement) signed integer of 1 or more bits |
| | 693 | in length. The first bit is taken as the sign bit, and any other bits |
| | 694 | provide greater precision than the -1 thru 0 range. The bit string is |
| | 695 | assumed to be big-endian, since it may not be possible to use little-endian |
| | 696 | in situations where the bit length isn't a multiple of 8. |
| | 697 | |
| | 698 | =item C<sys.rtn.Int.Blob_S_VBE_from_Int of NEBlob (RO: Int $int)> |
| | 699 | |
| | 700 | This selector function results in the C<Blob> value where its C<$int> |
| | 701 | argument is formatted as a variable-length binary (two's complement) signed |
| | 702 | integer of 1 or more bits in length; the smallest number of bits necessary |
| | 703 | to store C<$int> is used. |
| | 704 | |
| | 705 | =item C<sys.rtn.Int.Int_from_Blob_U_VBE of UInt (RO: NEBlob $blob)> |
| | 706 | |
| | 707 | This function is the same as C<sys.rtn.Int.Int_from_Blob_S_VBE> but that it |
| | 708 | does unsigned integers. |
| | 709 | |
| | 710 | =item C<sys.rtn.Int.Blob_U_VBE_from_Int of UInt (RO: NEBlob $blob)> |
| | 711 | |
| | 712 | This function is the same as C<sys.rtn.Int.Blob_S_VBE_from_Int> but that it |
| | 713 | does unsigned integers. |
| | 714 | |
| | 715 | =back |
| | 716 | |
| | 717 | =head2 Functions for sys.type.Blob |
| | 722 | |
| | 723 | =item C<sys.rtn.Blob.catenate of Blob (RO: Seq{Blob} $v)> |
| | 724 | |
| | 725 | This function results in the catenation of the N element values of its |
| | 726 | argument; it is a reduction operator that recursively takes each |
| | 727 | consecutive pair of input values and catenates (which is associative) them |
| | 728 | together until just one is left, which is the result. If C<$v> has zero |
| | 729 | values, then C<catenate> results in the empty string value, which is the |
| | 730 | identity value for catenate. |
| | 731 | |
| | 732 | =item C<sys.rtn.Blob.repeat of Blob (RO: Blob $v, UInt $count)> |
| | 733 | |
| | 734 | This function results in the catenation of C<$count> instances of C<$v>. |
| | 735 | |
| | 736 | =item C<sys.rtn.Blob.length_in_bits of UInt (RO: Blob $v)> |
| | 737 | |
| | 738 | This function results in the length of its argument in bits. |
| | 739 | |
| | 740 | =item C<sys.rtn.Blob.contains of Bool (RO: Blob $look_in, Blob $look_for, |
| | 741 | Bool $fixed_start, Bool $fixed_end)> |
| | 742 | |
| | 743 | This function results in C<Bool.True> iff its C<$look_for> argument is a |
| | 744 | substring of its C<$look_in> argument as per the optional C<$fixed_start> |
| | 745 | and C<$fixed_end> constraints, and C<Bool.False> otherwise. If |
| | 746 | C<$fixed_start> or C<$fixed_end> are C<Bool.True>, then C<$look_for> must |
| | 747 | occur right at the start or end, respectively, of C<$look_in> in order for |
| | 748 | C<contains> to results in C<Bool.True>; if either flag is C<Bool.False>, its |
| | 749 | additional constraint doesn't apply. |
| | 750 | |
| | 751 | =item C<sys.rtn.Blob.not of Blob (RO: Blob $v)> |
| | 752 | |
| | 753 | This function results in the bitwise I<not> of its argument. |
| | 754 | |
| | 755 | =item C<sys.rtn.Blob.and of Maybe{Blob} (RO: Set{Blob} $v)> |
| | 756 | |
| | 757 | This function is a reduction operator that recursively takes each pair of |
| | 758 | its N input element values and does a bitwise I<and> (which is both |
| | 759 | commutative and associative) on them until just one is left, a C<Maybe> |
| | 760 | whose single element is which is the function's result. This function |
| | 761 | throws an exception if not all input values are of the same length in bits. |
| | 762 | If C<$v> has zero values, then C<and> results in a same-typed C<Maybe> with |
| | 763 | zero elements. I<Note that, while C<and> could conceivably have been |
| | 764 | defined instead to not result in a C<Maybe>, but rather to result in the |
| | 765 | appropriate string of identity-valued bits, this option is avoided for now |
| | 766 | citing practical concerns in the face of infinite blob types; also, a |
| | 767 | default empty string result is being avoided.> |
| | 768 | |
| | 769 | =item C<sys.rtn.Blob.or of Maybe{Blob} (RO: Set{Blob} $v)> |
| | 770 | |
| | 771 | This function is a reduction operator that recursively takes each pair of |
| | 772 | its N input element values and does a bitwise inclusive-or (which is both |
| | 773 | commutative and associative) on them until just one is left, a C<Maybe> |
| | 774 | whose single element is which is the function's result. This function |
| | 775 | throws an exception if not all input values are of the same length in bits. |
| | 776 | If C<$v> has zero values, then C<or> results in a same-typed C<Maybe> with |
| | 777 | zero elements. I<The note for C<and> applies to C<or> too.> |
| | 778 | |
| | 779 | =item C<sys.rtn.Blob.xor of Maybe{Blob} (RO: Bag{Blob} $v)> |
| | 780 | |
| | 781 | This function is a reduction operator that recursively takes each pair of |
| | 782 | its N input element values and does a bitwise exclusive-or (which is both |
| | 783 | commutative and associative) on them until just one is left, a C<Maybe> |
| | 784 | whose single element is which is the function's result. This function |
| | 785 | throws an exception if not all input values are of the same length in bits. |
| | 786 | If C<$v> has zero values, then C<xor> results in a same-typed C<Maybe> with |
| | 787 | zero elements. I<The note for C<and> applies to C<xor> too.> |
| | 823 | |
| | 824 | =item C<sys.rtn.Text.catenate of Text (RO: Seq{Text} $v)> |
| | 825 | |
| | 826 | This function results in the catenation of the N element values of its |
| | 827 | argument; it is a reduction operator that recursively takes each |
| | 828 | consecutive pair of input values and catenates (which is associative) them |
| | 829 | together until just one is left, which is the result. If C<$v> has zero |
| | 830 | values, then C<catenate> results in the empty string value, which is the |
| | 831 | identity value for catenate. |
| | 832 | |
| | 833 | =item C<sys.rtn.Text.repeat of Text (RO: Text $v, UInt $count)> |
| | 834 | |
| | 835 | This function results in the catenation of C<$count> instances of C<$v>. |
| | 836 | |
| | 837 | =item C<sys.rtn.Text.length_in_nfd_graphs of UInt (RO: Text $v)> |
| | 838 | |
| | 839 | This function results in the length of its argument in Unicode |
| | 840 | Normalization Form D graphemes. |
| | 841 | |
| | 842 | =item C<sys.rtn.Text.length_in_nfc_graphs of UInt (RO: Text $v)> |
| | 843 | |
| | 844 | This function results in the length of its argument in Unicode |
| | 845 | Normalization Form C graphemes. |
| | 846 | |
| | 847 | =item C<sys.rtn.Text.length_in_nfd_codes of UInt (RO: Text $v)> |
| | 848 | |
| | 849 | This function results in the length of its argument in Unicode |
| | 850 | Normalization Form D code points. |
| | 851 | |
| | 852 | =item C<sys.rtn.Text.length_in_nfc_codes of UInt (RO: Text $v)> |
| | 853 | |
| | 854 | This function results in the length of its argument in Unicode |
| | 855 | Normalization Form C code points. |
| | 856 | |
| | 857 | =item C<sys.rtn.Text.contains of Bool (RO: Text $look_in, Text $look_for, |
| | 858 | Bool $fixed_start, Bool $fixed_end)> |
| | 859 | |
| | 860 | This function results in C<Bool.True> iff its C<$look_for> argument is a |
| | 861 | substring of its C<$look_in> argument as per the optional C<$fixed_start> |
| | 862 | and C<$fixed_end> constraints, and C<Bool.False> otherwise. If |
| | 863 | C<$fixed_start> or C<$fixed_end> are C<Bool.True>, then C<$look_for> must |
| | 864 | occur right at the start or end, respectively, of C<$look_in> in order for |
| | 865 | C<contains> to result in C<Bool.True>; if either flag is C<Bool.False>, its |
| | 866 | additional constraint doesn't apply. |
| | 867 | |
| | 868 | =item C<sys.rtn.Text.fold_case_to_upper (RO: Text $v)> |
| | 869 | |
| | 870 | This function results in the transformation of its argument where any Latin |
| | 871 | letters are folded to (capital) uppercase. |
| | 872 | |
| | 873 | =item C<sys.rtn.Text.fold_case_to_lower (RO: Text $v)> |
| | 874 | |
| | 875 | This function results in the transformation of its argument where any Latin |
| | 876 | letters are folded to (small) lowercase. |
| | 877 | |
| | 878 | =item C<sys.rtn.Text.trim_whitespace (RO: Text $v)> |
| | 879 | |
| | 880 | This function results in the value of its argument but that any leading or |
| | 881 | trailing whitespace characters are trimmed. |