Handbook
Glossary
present ( object -- string )
Converting objects to human-readable strings
Vocabulary
present
Inputs
object
an
object
Outputs
string
a
string
Generic word contract
Outputs a human-readable string from an object.
Notes
New methods can be defined by user code. Most often, this is done so that the object can be used with various words in the
html
.
components
or
urls
vocabularies.
Definition
IN:
present
GENERIC:
present
( object -- string )
Methods
USING:
kernel
present
quotations
sequences
splitting
;
M:
callable
present
[
"[ ]"
]
[
[
drop
"[ "
]
[
[
present
]
map
join-words
]
[
drop
" ]"
]
tri
3append
]
if-empty
;
USING:
accessors
kernel
math
math.parser
present
sequences
;
M:
complex
present
[
real>>
number>string
]
[
imaginary>>
[
number>string
]
[
0
>=
[
"+"
prepend
]
when
]
bi
]
bi
"j"
3append
;
USING:
effects
present
;
M:
effect
present
effect>string
;
USING:
kernel
present
;
M:
f
present
drop
""
;
USING:
accessors
io.sockets
kernel
math.parser
present
sequences
;
M:
inet4
present
[
host>>
]
[
port>>
number>string
]
bi
":"
glue
;
USING:
accessors
generic
io.sockets
kernel
math.parser
present
sequences
;
M:
inet6
present
[
M\
inet6
present
(call-next-method)
"["
"]"
surround
]
[
port>>
number>string
]
bi
":"
glue
;
USING:
accessors
io.sockets
kernel
math.parser
present
sequences
;
M:
inet
present
[
host>>
]
[
port>>
number>string
]
bi
":"
glue
;
USING:
accessors
io.styles
present
;
M:
input
present
string>>
;
USING:
accessors
io.sockets
present
;
M:
ipv4
present
host>>
;
USING:
accessors
io.sockets
kernel
math
math.parser
present
sequences
;
M:
ipv6
present
[
host>>
]
[
scope-id>>
]
bi
[
number>string
"%"
glue
]
unless-zero
;
USING:
accessors
io.sockets
present
sequences
;
M:
local
present
path>>
"Unix domain socket: "
prepend
;
USING:
accessors
io.pathnames
present
;
M:
pathname
present
string>>
;
USING:
accessors
alien.c-types
present
sequences
;
M:
pointer
present
to>>
name>>
"*"
append
;
USING:
math
math.parser
present
;
M:
real
present
number>string
;
USING:
accessors
io.sockets.secure
present
sequences
;
M:
secure
present
addrspec>>
present
" (secure)"
append
;
USING:
present
strings
;
M:
string
present
;
USING:
calendar
calendar.format
present
;
M:
timestamp
present
timestamp>string
;
USING:
accessors
assocs
combinators
kernel
make
present
urls
urls.encoding
urls.private
;
M:
url
present
[
{
[
unparse-protocol
]
[
unparse-authority
]
[
unparse-path
]
[
query>>
dup
assoc-empty?
[
drop
]
[
"?"
%
assoc>query
%
]
if
]
[
anchor>>
[
"#"
%
present
url-encode
%
]
when*
]
}
cleave
]
""
make
;
USING:
accessors
present
vocabs
;
M:
vocab-spec
present
name>>
;
USING:
accessors
present
words
;
M:
word
present
name>>
;