Changeset 40426 in project


Ignore:
Timestamp:
09/07/21 02:20:50 (2 weeks ago)
Author:
Zipheir
Message:

Document basic I/O procedures for SRFI 135 text(ual)s.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/srfi-135

    r40425 r40426  
    921921<procedure>(generator->text gen [max]) → text</procedure>
    922922
    923 Returns a text of the characters produced by {{gen}}, in order. If
    924 {{max}} is provided and is an exact natural number, then at most
    925 {{max}} values will be read from {{gen}}.  Otherwise, reading
    926 continues until {{gen}} returns EOF.
     923Returns a text of the characters produced by ''gen'', in order. If
     924''max'' is provided and is an exact natural number, then at most
     925''max'' values will be read from ''gen''.  Otherwise, reading
     926continues until ''gen'' returns EOF.
    927927
    928928Example:
     
    952952</enscript>
    953953
     954=== I/O
     955
     956<procedure>(text-read-line [port]) → text-or-eof</procedure>
     957
     958Analogous to R7RS {{read-line}}. Reads a newline-delimited line from
     959''port'' and returns it as a text, without the terminating newline.
     960''port'' defaults to the value of {{(current-input-port)}}. If an EOF
     961is encountered before a newline but after some input has been read,
     962then a text containing this input is returned. If an EOF is
     963encountered before any input has been read, then an EOF object is
     964returned.
     965
     966CRLF and CRCR
LF line terminators are not yet supported.
     967
     968<procedure>(read-text max [port]) → text-or-eof</procedure>
     969
     970Analogous to R7RS {{read-string}}. Reads at most ''max'' characters
     971from ''port'' (which defaults to the current input port) and returns
     972the result as a text. If an EOF is encountered before any input has
     973been read, then an EOF object is returned.
     974
     975<procedure>(text-read-lines [port [max]]) → list[text]</procedure>
     976
     977Analogous to {{read-lines}} from {{(chicken io)}}. Reads lines (as
     978with {{text-read-line}}) from ''port'' and returns the result as
     979a list. ''port'' defaults to the current input port. If ''max'' is
     980supplied, then at most ''max'' lines are read; otherwise, reading
     981continues until an EOF is encountered. If an EOF is encountered
     982immediately, the empty list is returned.
     983
     984<procedure>(write-textual textual [port [start [end]]]) → void</procedure>
     985
     986Analogous to R7RS {{write-string}}. Writes ''textual'' to ''port'',
     987which defaults to the current output port. If ''start'' or ''end''
     988are provided, then only a subtext(ual) of ''textual'' is written.
     989
    954990== About This Egg
    955991
     
    963999* [[r7rs]]
    9641000* [[typed-records]]
     1001
     1002To run the included tests, the [[test]] and [[srfi-158]] eggs are
     1003also required.
    9651004
    9661005=== Type and bound checks
Note: See TracChangeset for help on using the changeset viewer.