Download STK Reference manual

Transcript
STk Reference Manual
31
Port->list uses the reader function to repeatedly read objects from port. Thes objects are
accumulated in a list which is returned upon eof.
(port->list read-line (open-input-file "| (echo AAA; echo BBB)"))
=⇒ ("AAA" "BBB")
Port->string-list reads the input port line by line until eof, then returns the accumulated
list of lines. This procedure is defined as
(define port->string-list (lambda (p)(port->list read-line p)))
Port->sexp-list repeatedly reads data from the port until eof, then returns the accumulated
list of items. This procedure is defined as
(define port->sexp-list (lambda (p) (port->list read p)))
For instance, the following expression gives the list of users currently connected on the machine
running the STk interpreter.
(port->sexp-list (open-input-file "| users"))
(transcript-on filename)
(transcript-off)
procedure
procedure
Not implemented.
6.11
Keywords
Keywords are symbolic constants which evaluate to themselves. A keyword must begin with
a colon.
(keyword? obj )
procedure
Returns #t if obj is a keyword, otherwise returns #f.
(make-keyword obj )
procedure
Builds a keyword from the given obj . obj must be a symbol or a string. A colon is automatically prepended.
(make-keyword
=⇒
(make-keyword
=⇒
(make-keyword
=⇒
"test")
:test
’test)
:test
":hello")
::hello
(keyword->string keyword)
procedure
Returns the name of keyword as a string. The leading colon is included in the result.