Changeset 39473 in project
- Timestamp:
- 12/30/20 20:01:25 (4 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/5/srfi-135
r39242 r39473 92 92 <procedure>(text? obj) â boolean</procedure> 93 93 94 Is {{obj}} an immutable text? In particular, {{(text? obj)}}95 returns false if {{(string? obj)}} returns true, which94 Is ''obj'' an immutable text? In particular, {{(text?}} ''obj''{{)}} 95 returns false if {{(string?}} ''obj''{{)}} returns true, which 96 96 implies {{string?}} returns false if {{text?}} returns true. 97 97 98 98 <procedure>(textual? obj) â boolean</procedure> 99 99 100 Returns true if and only {{obj}}is an immutable text or a string.100 Returns true if and only ''obj'' is an immutable text or a string. 101 101 102 102 <procedure>(textual-null? text) â boolean</procedure> 103 103 104 Is {{text}}the empty text?104 Is ''text'' the empty text? 105 105 106 106 <procedure>(textual-every pred textual [start end]) â value</procedure> 107 107 <procedure>(textual-any pred textual [start end]) â value</procedure> 108 108 109 Checks to see if every/any character in {{textual}}satisfies110 {{pred}}, proceeding from left (index {{start}}) to right (index111 {{end}}). These procedures are short-circuiting: if {{pred}}returns112 false, {{textual-every}} does not call {{pred}}on subsequent characters;113 if {{pred}} returns true, {{textual-any}} does not call {{pred}}on109 Checks to see if every/any character in ''textual'' satisfies 110 ''pred'', proceeding from left (index ''start'') to right (index 111 ''end''). These procedures are short-circuiting: if ''pred'' returns 112 false, {{textual-every}} does not call ''pred'' on subsequent characters; 113 if ''pred'' returns true, {{textual-any}} does not call ''pred'' on 114 114 subsequent characters; Both procedures are "witness-generating": 115 115 116 * If {{textual-every}} is given an empty interval (with {{start}} = {{end}}), it returns {{#t}}.117 118 * If {{textual-every}} returns true for a non-empty interval (with {{start}} < {{end}}), the returned true value is the one returned by the final call to the predicate on {{(text-ref (textual-copy text) (- end1))}}.116 * If {{textual-every}} is given an empty interval (with ''start'' = ''end''), it returns {{#t}}. 117 118 * If {{textual-every}} returns true for a non-empty interval (with ''start'' < ''end''), the returned true value is the one returned by the final call to the predicate on {{(text-ref (textual-copy}} ''text''{{) (-}} ''end'' {{1))}}. 119 119 120 120 * If {{textual-any}} returns true, the returned true value is the one returned by the predicate. … … 137 137 <procedure>(text-tabulate proc len) â text</procedure> 138 138 139 {{proc}}is a procedure that accepts an exact integer as its139 ''proc'' is a procedure that accepts an exact integer as its 140 140 argument and returns a character. Constructs a text of 141 size {{len}} by calling {{proc}}on each value from 0 (inclusive)142 to {{len}}(exclusive) to produce the corresponding element143 of the text. The order in which {{proc}}is called on those141 size ''len'' by calling ''proc'' on each value from 0 (inclusive) 142 to ''len'' (exclusive) to produce the corresponding element 143 of the text. The order in which ''proc'' is called on those 144 144 indexes is not specified. 145 145 … … 147 147 This is a fundamental constructor for texts. 148 148 149 * {{successor}} is used to generate a series of "seed" values from the initial seed: {{seed}}, {{(successor seed)}}, {{(successor^2 seed)}}, {{(successor^3 seed)}}, ...150 151 * {{stop?}}tells us when to stop â when it returns true when applied to one of these seed values.152 153 * {{mapper}} maps each seed value to the corresponding character(s) in the result text, which are assembled into that text in left-to-right order. It is an error for {{mapper}}to return anything other than a character, string, or text.154 155 * {{base}}is the optional initial/leftmost portion of the constructed text, which defaults to the empty text {{(text)}}. It is an error if base is anything other than a character, string, or text.156 157 * {{make-final}} is applied to the terminal seed value (on which {{stop?}} returns true) to produce the final/rightmost portion of the constructed text. It defaults to {{(lambda (x) (text))}}. It is an error for {{make-final}}to return anything other than a character, string, or text.149 * ''successor'' is used to generate a series of "seed" values from the initial seed: ''seed'', (''successor seed''), (''successor''^2 ''seed''), (''successor''^3 ''seed''), ... 150 151 * ''stop?'' tells us when to stop â when it returns true when applied to one of these seed values. 152 153 * ''mapper'' maps each seed value to the corresponding character(s) in the result text, which are assembled into that text in left-to-right order. It is an error for ''mapper'' to return anything other than a character, string, or text. 154 155 * ''base'' is the optional initial/leftmost portion of the constructed text, which defaults to the empty text {{(text)}}. It is an error if base is anything other than a character, string, or text. 156 157 * ''make-final'' is applied to the terminal seed value (on which ''stop?'' returns true) to produce the final/rightmost portion of the constructed text. It defaults to {{(lambda (x) (text))}}. It is an error for ''make-final'' to return anything other than a character, string, or text. 158 158 159 159 {{text-unfold}} is a fairly powerful text constructor. You … … 179 179 180 180 This is a fundamental constructor for texts. It is the 181 same as {{text-unfold}} except the results of {{mapper}}are182 assembled into the text in right-to-left order, {{base}}is181 same as {{text-unfold}} except the results of ''mapper'' are 182 assembled into the text in right-to-left order, ''base'' is 183 183 the optional rightmost portion of the constructed text, 184 and {{make-final}}produces the leftmost portion of the184 and ''make-final'' produces the leftmost portion of the 185 185 constructed text. 186 186 … … 298 298 299 299 {{textual-length}} returns the number of characters in 300 {{textual}}, and {{textual-ref}} returns the character at301 character index {{idx}}, using 0-origin indexing. These300 ''textual'', and {{textual-ref}} returns the character at 301 character index ''idx'', using 0-origin indexing. These 302 302 procedures are the generalizations of {{text-length}} and 303 {{text-ref}} to accept strings as well as texts. If {{textual}}303 {{text-ref}} to accept strings as well as texts. If ''textual'' 304 304 is a text, they must execute in O(1) time, but there is 305 no such requirement if {{textual}}is a string.305 no such requirement if ''textual'' is a string. 306 306 307 307 <procedure>(subtext text start end) â text</procedure> … … 309 309 310 310 These procedures return a text containing the characters 311 of {{text}} or {{textual}} beginning with index {{start}}(inclusive)312 and ending with index {{end}}(exclusive).313 314 If {{textual}}is a string, then that string does not share any311 of ''text'' or ''textual'' beginning with index ''start'' (inclusive) 312 and ending with index ''end'' (exclusive). 313 314 If ''textual'' is a string, then that string does not share any 315 315 storage with the result, so subsequent mutation of that 316 316 string will not affect the text returned by {{subtextual}}. … … 318 318 {{subtext}}, the implementation returns a result that shares 319 319 storage with that text. These procedures just return their 320 first argument when that argument is a text, {{start}}is 0, and321 {{end}}is the length of that text.320 first argument when that argument is a text, ''start'' is 0, and 321 ''end'' is the length of that text. 322 322 323 323 <procedure>(textual-copy textual [start end]) â text</procedure> 324 324 325 Returns a text containing the characters of {{textual}}326 beginning with index {{start}}(inclusive) and ending with327 index {{end}}(exclusive).325 Returns a text containing the characters of ''textual'' 326 beginning with index ''start'' (inclusive) and ending with 327 index ''end'' (exclusive). 328 328 329 329 Unlike {{subtext}} and {{subtextual}}, the result of {{textual-copy}} … … 333 333 334 334 If {{textual-copy}} returns an empty text, that empty text 335 may be {{eq?}} or {{eqv?}} to the text returned by {{(text)}}.335 may be {{eq?}} or {{eqv?}} to the text returned by ''(text)''. 336 336 If the text returned by {{textual-copy}} is non-empty, then it 337 337 is not {{eqv?}} to any previously extant object. … … 342 342 <procedure>(textual-drop-right textual nchars) â text</procedure> 343 343 344 {{textual-take}} returns a text containing the first {{nchars}}345 of {{textual}}; {{textual-drop}} returns a text containing all346 but the first {{nchars}} of {{textual}}. {{textual-take-right}}347 returns a text containing the last {{nchars}} of {{textual}};344 {{textual-take}} returns a text containing the first ''nchars'' 345 of ''textual''; {{textual-drop}} returns a text containing all 346 but the first ''nchars'' of ''textual''. {{textual-take-right}} 347 returns a text containing the last ''nchars'' of ''textual''; 348 348 {{textual-drop-right}} returns a text containing all but the 349 last {{nchars}} of {{textual}}.350 351 If {{textual}}is a string, then that string does not share349 last ''nchars'' of ''textual''. 350 351 If ''textual'' is a string, then that string does not share 352 352 any storage with the result, so subsequent mutation of 353 353 that string will not affect the text returned by these 354 procedures. If {{textual}}is a text, the result shares storage with354 procedures. If ''textual'' is a text, the result shares storage with 355 355 that text. 356 356 … … 370 370 <procedure>(textual-pad-right textual len [char start end]) â text</procedure> 371 371 372 Returns a text of length {{len}}comprised of the characters373 drawn from the given subrange of {{textual}}, padded on the374 left (right) by as many occurrences of the character {{char}}375 as needed. If {{textual}} has more than {{len}}chars, it is376 truncated on the left (right) to length {{len}}. {{char}}372 Returns a text of length ''len'' comprised of the characters 373 drawn from the given subrange of ''textual'', padded on the 374 left (right) by as many occurrences of the character ''char'' 375 as needed. If ''textual'' has more than ''len'' chars, it is 376 truncated on the left (right) to length ''len''. ''char'' 377 377 defaults to {{#\space}}. 378 378 379 If {{textual}}is a string, then that string does not share379 If ''textual'' is a string, then that string does not share 380 380 any storage with the result, so subsequent mutation of 381 381 that string will not affect the text returned by these 382 procedures. If {{textual}}is a text, the result shares storage382 procedures. If ''textual'' is a text, the result shares storage 383 383 with that text whenever sharing would be space-efficient. 384 384 … … 394 394 395 395 Returns a text obtained from the given subrange of 396 {{textual}}by skipping over all characters on the left / on396 ''textual'' by skipping over all characters on the left / on 397 397 the right / on both sides that satisfy the second 398 argument {{pred}}: {{pred}}defaults to {{char-whitespace?}}.399 400 If {{textual}}is a string, then that string does not share398 argument ''pred'': ''pred'' defaults to {{char-whitespace?}}. 399 400 If ''textual'' is a string, then that string does not share 401 401 any storage with the result, so subsequent mutation of 402 402 that string will not affect the text returned by these 403 procedures. If {{textual}}is a text, the result shares storage403 procedures. If ''textual'' is a text, the result shares storage 404 404 with that text whenever sharing would be space-efficient. 405 405 … … 420 420 </enscript> 421 421 422 That is, the segment of characters in {{textual1}}from423 {{start1}} to {{end1}}is replaced by the segment of characters424 in {{textual2}} from {{start2}} to {{end2}}. If {{start1}} = {{end1}},425 this simply splices the characters drawn from {{textual2}}into426 {{textual1}}at that position.422 That is, the segment of characters in ''textual1'' from 423 ''start1'' to ''end1'' is replaced by the segment of characters 424 in ''textual2'' from ''start2'' to ''end2''. If ''start1'' = ''end1'', 425 this simply splices the characters drawn from ''textual2'' into 426 ''textual1'' at that position. 427 427 428 428 Examples: … … 488 488 These procedures behave as though they had called 489 489 {{textual-foldcase}} on their arguments before applying the 490 corresponding procedures without " -ci".490 corresponding procedures without "{{-ci}}". 491 491 492 492 === Prefixes & suffixes … … 496 496 497 497 Return the length of the longest common prefix/suffix of 498 {{textual1}} and {{textual2}}. For prefixes, this is equivalent498 ''textual1'' and ''textual2''. For prefixes, this is equivalent 499 499 to their "mismatch index" (relative to the start 500 500 indexes). 501 501 502 The optional {{start}}/{{end}}indexes restrict the comparison to503 the indicated subtexts of {{textual1}} and {{textual2}}.502 The optional ''start''/''end'' indexes restrict the comparison to 503 the indicated subtexts of ''textual1'' and ''textual2''. 504 504 505 505 <procedure>(textual-prefix? textual1 textual2 [start1 end1 start2 end2]) â boolean</procedure> 506 506 <procedure>(textual-suffix? textual1 textual2 [start1 end1 start2 end2]) â boolean</procedure> 507 507 508 Is {{textual1}} a prefix/suffix of {{textual2}}?508 Is ''textual1'' a prefix/suffix of ''textual2''? 509 509 510 510 The optional start/end indexes restrict the comparison to 511 the indicated subtexts of {{textual1}} and {{textual2}}.511 the indicated subtexts of ''textual1'' and ''textual2''. 512 512 513 513 === Searching … … 518 518 <procedure>(textual-skip-right textual pred [start end]) â idx-or-false</procedure> 519 519 520 {{textual-index}}searches through the given subtext or520 ''textual-index'' searches through the given subtext or 521 521 substring from the left, returning the index of the 522 leftmost character satisfying the predicate {{pred}}.522 leftmost character satisfying the predicate ''pred''. 523 523 {{textual-index-right}} searches from the right, returning 524 524 the index of the rightmost character satisfying the 525 predicate {{pred}}. If no match is found, these procedures525 predicate ''pred''. If no match is found, these procedures 526 526 return {{#f}}. 527 527 528 The {{start}} and {{end}}arguments specify the beginning and end528 The ''start'' and ''end'' arguments specify the beginning and end 529 529 of the search; the valid indexes relevant to the search 530 include {{start}} but exclude {{end}}. Beware of "fencepost"530 include ''start'' but exclude ''end''. Beware of "fencepost" 531 531 errors: when searching right-to-left, the first index 532 considered is {{(- end1)}}, whereas when searching533 left-to-right, the first index considered is {{start}}. That532 considered is {{(-}} ''end'' {{1)}}, whereas when searching 533 left-to-right, the first index considered is ''start''. That 534 534 is, the start/end indexes describe the same half-open 535 interval [ start,end) in these procedures that they do in535 interval [''start'',''end'') in these procedures that they do in 536 536 all other procedures specified by this SRFI. 537 537 538 538 The skip functions are similar, but use the complement of 539 539 the criterion: they search for the first char that 540 doesn't satisfy {{pred}}. To skip over initial whitespace,540 doesn't satisfy ''pred''. To skip over initial whitespace, 541 541 for example, say 542 542 … … 556 556 <procedure>(textual-contains-right textual1 textual2 [start1 end1 start2 end2]) â idx-or-false</procedure> 557 557 558 Does the subtext of {{textual1}} specified by {{start1}} and {{end1}}558 Does the subtext of ''textual1'' specified by ''start1'' and ''end1'' 559 559 contain the sequence of characters given by the subtext 560 of {{textual2}} specified by {{start2}} and {{end2}}?561 562 Returns {{#f}} if there is no match. If {{start2}} = {{end2}},563 {{textual-contains}} returns {{start1}}but564 {{textual-contains-right}} returns {{end1}}. Otherwise returns565 the index in {{textual1}}for the first character of the560 of ''textual2'' specified by ''start2'' and ''end2''? 561 562 Returns {{#f}} if there is no match. If ''start2'' = ''end2'', 563 {{textual-contains}} returns ''start1'' but 564 {{textual-contains-right}} returns ''end1''. Otherwise returns 565 the index in ''textual1'' for the first character of the 566 566 first/last match; that index lies within the half-open 567 interval {{[start1,end1)}}, and the match lies entirely568 within the {{[start1,end1)}} range of {{textual1}}.567 interval [''start1'',''end1''), and the match lies entirely 568 within the [''start1'',''end1'') range of ''textual1''. 569 569 570 570 <enscript highlight="scheme"> … … 617 617 (textual-concatenate (reverse textual-list)) 618 618 </enscript> 619 If the optional argument {{final-textual}}is specified, it620 is effectively consed onto the beginning of {{textual-list}}619 If the optional argument ''final-textual'' is specified, it 620 is effectively consed onto the beginning of ''textual-list'' 621 621 before performing the list-reverse and 622 622 {{textual-concatenate}} operations. 623 623 624 If the optional argument {{end}}is given, only the625 characters up to but not including {{end}} in {{final-textual}}624 If the optional argument ''end'' is given, only the 625 characters up to but not including ''end'' in ''final-textual'' 626 626 are added to the result, thus producing 627 627 <enscript highlight="scheme"> … … 641 641 together using the delimiter text. 642 642 643 {{textual-list}} is a list of texts and/or strings. {{delimiter}} 644 is a text or a string. The {{grammar}}argument is a symbol643 ''textual-list'' is a list of texts and/or strings. ''delimiter'' 644 is a text or a string. The ''grammar'' argument is a symbol 645 645 that determines how the delimiter is used, and defaults 646 to {{ 'infix}}. It is an error for {{grammar}}to be any symbol646 to {{infix}}. It is an error for ''grammar'' to be any symbol 647 647 other than these four: 648 648 649 * {{ 'infix}} means an infix or separator grammar: insert the delimiter between list elements. An empty list will produce an empty text.650 651 * {{ 'strict-infix}} means the same as 'infixif the textual-list is non-empty, but will signal an error if given an empty list. (This avoids an ambiguity shown in the examples below.)652 653 * {{ 'suffix}} means a suffix or terminator grammar: insert the delimiter after every list element.654 655 * {{ 'prefix}} means a prefix grammar: insert the delimiter before every list element.649 * {{infix}} means an infix or separator grammar: insert the delimiter between list elements. An empty list will produce an empty text. 650 651 * {{strict-infix}} means the same as {{infix}} if the textual-list is non-empty, but will signal an error if given an empty list. (This avoids an ambiguity shown in the examples below.) 652 653 * {{suffix}} means a suffix or terminator grammar: insert the delimiter after every list element. 654 655 * {{prefix}} means a prefix grammar: insert the delimiter before every list element. 656 656 657 657 The delimiter is the text used to delimit elements; it … … 680 680 These are the fundamental iterators for texts. 681 681 682 The {{textual-fold}} procedure maps the {{kons}}procedure across682 The ''textual-fold'' procedure maps the ''kons'' procedure across 683 683 the given text or string from left to right: 684 684 … … 687 687 </enscript> 688 688 689 In other words, {{textual-fold}}obeys the (tail) recursion689 In other words, ''textual-fold'' obeys the (tail) recursion 690 690 691 691 <enscript highlight="scheme"> … … 693 693 </enscript> 694 694 695 The {{textual-fold-right}} procedure maps {{kons}}across the695 The {{textual-fold-right}} procedure maps ''kons'' across the 696 696 given text or string from right to left: 697 697 … … 727 727 <procedure>(textual-map proc textual1 textual2 ...) â text</procedure> 728 728 729 It is an error if {{proc}}does not accept as many arguments730 as the number of {{textual}}arguments passed to {{textual-map}},729 It is an error if ''proc'' does not accept as many arguments 730 as the number of ''textual'' arguments passed to {{textual-map}}, 731 731 does not accept characters as arguments, or returns a 732 732 value that is not a character, string, or text. 733 733 734 The textual-map procedure applies {{proc}}element-wise to735 the characters of the {{textual}}arguments, converts each736 value returned by {{proc}}to a text, and returns the737 concatenation of those texts. If more than one {{textual}}734 The textual-map procedure applies ''proc'' element-wise to 735 the characters of the ''textual'' arguments, converts each 736 value returned by ''proc'' to a text, and returns the 737 concatenation of those texts. If more than one ''textual'' 738 738 argument is given and not all have the same length, then 739 {{textual-map}} terminates when the shortest {{textual}}argument740 runs out. The dynamic order in which {{proc}}is called on741 the characters of the {{textual}}arguments is unspecified,739 {{textual-map}} terminates when the shortest ''textual'' argument 740 runs out. The dynamic order in which ''proc'' is called on 741 the characters of the ''textual'' arguments is unspecified, 742 742 as is the dynamic order in which the coercions are 743 performed. If any strings returned by {{proc}}are mutated743 performed. If any strings returned by ''proc'' are mutated 744 744 after they have been returned and before the call to 745 745 {{textual-map}} has returned, then {{textual-map}} returns a text … … 763 763 <procedure>(textual-for-each proc textual1 textual2 ...) â unspecified</procedure> 764 764 765 It is an error if {{proc}}does not accept as many arguments766 as the number of {{textual}}arguments passed to {{textual-for-each}}765 It is an error if ''proc'' does not accept as many arguments 766 as the number of ''textual'' arguments passed to {{textual-for-each}} 767 767 or does not accept characters as arguments. 768 768 769 The {{textual-for-each}} procedure applies {{proc}}element-wise770 to the characters of the {{textual}}arguments, going from771 left to right. If more than one {{textual}}argument is given769 The {{textual-for-each}} procedure applies ''proc'' element-wise 770 to the characters of the ''textual'' arguments, going from 771 left to right. If more than one ''textual'' argument is given 772 772 and not all have the same length, then {{textual-for-each}} 773 terminates when the shortest {{textual}}argument runs out.773 terminates when the shortest ''textual'' argument runs out. 774 774 775 775 <procedure>(textual-map-index proc textual [start end]) â text</procedure> 776 776 777 Calls {{proc}}on each valid index of the specified subtext777 Calls ''proc'' on each valid index of the specified subtext 778 778 or substring, converts the results of those calls into 779 779 texts, and returns the concatenation of those texts. It 780 is an error for {{proc}}to return anything other than a780 is an error for ''proc'' to return anything other than a 781 781 character, string, or text. The dynamic order in which 782 {{proc}}is called on the indexes is unspecified, as is the782 ''proc'' is called on the indexes is unspecified, as is the 783 783 dynamic order in which the coercions are performed. If 784 any strings returned by {{proc}}are mutated after they have784 any strings returned by ''proc'' are mutated after they have 785 785 been returned and before the call to {{textual-map-index}} 786 786 has returned, then {{textual-map-index}} returns a text with … … 790 790 <procedure>(textual-for-each-index proc textual [start end]) â unspecified</procedure> 791 791 792 Calls {{proc}}on each valid index of the specified subtext792 Calls ''proc'' on each valid index of the specified subtext 793 793 or substring, in increasing order, discarding the results 794 794 of those calls. This is simply a safe and correct way to … … 815 815 <procedure>(textual-remove pred textual [start end]) â text</procedure> 816 816 817 Filter the given subtext of {{textual}}, retaining only those818 characters that satisfy / do not satisfy {{pred}}.819 820 If {{textual}}is a string, then that string does not share817 Filter the given subtext of ''textual'', retaining only those 818 characters that satisfy / do not satisfy ''pred''. 819 820 If ''textual'' is a string, then that string does not share 821 821 any storage with the result, so subsequent mutation of 822 822 that string will not affect the text returned by these 823 procedures. If {{textual}}is a text, the result shares storage823 procedures. If ''textual'' is a text, the result shares storage 824 824 with that text whenever sharing would be space-efficient. 825 825 … … 831 831 replicated copying of a subtext or substring. 832 832 833 {{textual}} is a text or string; {{start}} and {{end}}are optional834 arguments that specify a subtext of {{textual}}, defaulting835 to 0 and the length of {{textual}}. This subtext is833 ''textual'' is a text or string; ''start'' and ''end'' are optional 834 arguments that specify a subtext of ''textual'', defaulting 835 to 0 and the length of ''textual''. This subtext is 836 836 conceptually replicated both up and down the index space, 837 837 in both the positive and negative directions. For 838 example, if {{textual}} is {{"abcdefg"}}, {{start}} is 3, and {{end}}838 example, if ''textual'' is {{"abcdefg"}}, ''start'' is 3, and ''end'' 839 839 is 6, then we have the conceptual bidirectionally-infinite 840 840 text … … 844 844 845 845 {{textual-replicate}} returns the subtext of this text 846 beginning at index {{from}}, and ending at {{to}}. It is an error847 if {{from}} is greater than {{to}}.846 beginning at index ''from'', and ending at ''to''. It is an error 847 if ''from'' is greater than ''to''. 848 848 849 849 You can use {{textual-replicate}} to perform a variety of 850 850 tasks: 851 851 852 * To rotate a text left: {{(textual-replicate "abcdef" 2 8) â«cdefab»}}853 854 * To rotate a text right: {{(textual-replicate "abcdef" -2 4) â«efabcd»}}855 856 * To replicate a text: {{(textual-replicate "abc" 0 7) â«abcabca»}}852 * To rotate a text left: {{(textual-replicate "abcdef" 2 8)}} â {{«cdefab»}} 853 854 * To rotate a text right: {{(textual-replicate "abcdef" -2 4)}} â {{«efabcd»}} 855 856 * To replicate a text: {{(textual-replicate "abc" 0 7)}} â {{«abcabca»}} 857 857 858 858 Note that 859 859 860 * The {{from}}/{{to}} arguments give a half-open range containing the characters from index {{from}} up to, but not including, index {{to}}.861 862 * The {{from}}/{{to}} indexes are not expressed in the index space of {{textual}}. They refer instead to the replicated index space of the subtext defined by {{textual}}, {{start}}, and {{end}}.863 864 It is an error if {{start}} = {{end}}, unless {{from}} = {{to}}, which is860 * The ''from''/''to'' arguments give a half-open range containing the characters from index ''from'' up to, but not including, index ''to''. 861 862 * The ''from''/''to'' indexes are not expressed in the index space of ''textual''. They refer instead to the replicated index space of the subtext defined by ''textual'', ''start'', and ''end''. 863 864 It is an error if ''start'' = ''end'', unless ''from'' = ''to'', which is 865 865 allowed as a special case. 866 866 … … 868 868 869 869 Returns a list of texts representing the words contained 870 in the subtext of {{textual}} from {{start}} (inclusive) to {{end}}871 (exclusive). The {{delimiter}}is a text or string to be used870 in the subtext of ''textual'' from ''start'' (inclusive) to ''end'' 871 (exclusive). The ''delimiter'' is a text or string to be used 872 872 as the word separator. This will often be a single 873 873 character, but multiple characters are allowed for use 874 874 cases such as splitting on {{"\r\n"}}. The returned list will 875 875 have one more item than the number of non-overlapping 876 occurrences of the delimiter in the text. If {{delimiter}}is876 occurrences of the delimiter in the text. If ''delimiter'' is 877 877 an empty text, then the returned list contains a list of 878 878 texts, each of which contains a single character. 879 879 880 The {{grammar}}is a symbol with the same meaning as in the881 {{textual-join}} procedure. If it is {{infix}}, which is the880 The ''grammar'' is a symbol with the same meaning as in the 881 {{textual-join}} procedure. If it is ''infix'', which is the 882 882 default, processing is done as described above, except an 883 empty {{textual}} produces the empty list; if {{grammar}}is884 {{strict-infix}}, then an empty {{textual}}signals an error. The885 values {{prefix}} and {{suffix}}cause a leading/trailing empty883 empty ''textual'' produces the empty list; if ''grammar'' is 884 ''strict-infix'', then an empty ''textual'' signals an error. The 885 values ''prefix'' and ''suffix'' cause a leading/trailing empty 886 886 text in the result to be suppressed. 887 887 888 If {{limit}}is a non-negative exact integer, at most that889 many splits occur, and the remainder of {{textual}}is888 If ''limit'' is a non-negative exact integer, at most that 889 many splits occur, and the remainder of ''textual'' is 890 890 returned as the final element of the list (so the result 891 will have at most {{limit+1}} elements). If {{limit}}is not891 will have at most ''limit''+1 elements). If ''limit'' is not 892 892 specified or is {{#f}}, then as many splits as possible are 893 made. It is an error if {{limit}}is any other value.894 895 To split on a regular expression {{re}}, use SRFI 115's893 made. It is an error if ''limit'' is any other value. 894 895 To split on a regular expression ''re'', use SRFI 115's 896 896 {{regexp-split}} procedure: 897 897 … … 917 917 === Version History 918 918 919 ; 0.1 (2020-11-12) :Initial release.919 ; 0.1 : (2020-11-12) Initial release. 920 920 921 921 == License
Note: See TracChangeset
for help on using the changeset viewer.