object
Factor handbook » The language » Objects » Classes

Prev:Class predicate words
Next:null


Vocabulary
kernel

Class description
The class of all objects. If a generic word defines a method specializing on this class, the method is used as a fallback, if no other applicable method is found. For instance:
GENERIC: enclose ( number -- array ) M: number enclose 1array ; M: object enclose ;


Definition


Methods





















































































M:: object %mneg ( dst src1 src2 -- )
dst src2 eq?
[ dst src2 src1 %mul ] [ dst src1 src2 %mul ] if
dst dst %neg ;







































































































































M: object (set-post-data-headers)
drop "chunked" "transfer-encoding" pick set-at ;









M:: object (vbdot2+) ( a b accumulator -- result )
4 <iota> [| lane |
lane accumulator nth lane 2 * a nth lane 2 * 1 + a nth
lane 2 * b nth lane 2 * 1 + b nth bfloat-dot-add
] float-4 new map-as ;



M:: object (vbmatmul2x4+) ( a b accumulator -- result )
4 <iota> [| lane |
lane 2 /i 4 * :> row lane 2 mod 4 *
:> column lane accumulator nth row a nth row 1 + a nth
column b nth column 1 + b nth bfloat-dot-add row 2 +
a nth row 3 + a nth column 2 + b nth column 3 + b nth
bfloat-dot-add
] float-4 new map-as ;



M:: object (vdot4+) ( a b accumulator -- result )
4 <iota> [| lane |
lane accumulator nth 4 <iota> swap [| value j |
lane 4 * j + :> index index a nth index b nth *
value +
] reduce
] accumulator map-as ;



M:: object (vmatmul2x8+) ( a b accumulator -- result )
4 <iota> [| lane |
lane accumulator nth 8 <iota> swap [| value j |
lane 2 /i 8 * j + a nth lane 2 mod 8 * j + b nth *
value +
] reduce
] accumulator map-as ;





















M:: object <menu-item> ( target hook command -- menu-item )
command command-name [
hook call target command command-button-quot call
hide-glass
] <menu-button> ;









M: object <test-secure-config>*
drop
<secure-config> "vocab:openssl/test-1.2/server.pem"
>>key-file "vocab:openssl/test-1.2/dh2048.pem" >>dh-file
"password" >>password ;

























































M: object >post-data
"application/octet-stream" <post-data> swap >>data ;






























M:: object >uniform-matrix ( sequence cols rows -- c-array )
sequence flip cols head-slice
[ rows head-slice float >c-array ] { } map-as concat ;
inline


























































































M:: object answer ( class from to -- new-class )
class from = to class ? ;































































































































































































































































































































































































































































M: object g drop "object" ;





















M:: object half-binary ( a b op -- result )
a b op {
{ "+" [ [ + ] 2map ] }
{ "-" [ [ - ] 2map ] }
{ "*" [ [ * ] 2map ] }
{ "/" [ [ /f ] 2map ] }
{ "min" [ [ min-vector-lane ] 2map ] }
{ "max" [ [ max-vector-lane ] 2map ] }
{
"="
[ [ = -1 0 ? ] ushort-8 new 2map-as half-8-cast ]
}
{
"<"
[ [ < -1 0 ? ] ushort-8 new 2map-as half-8-cast ]
}
{
"<="
[ [ <= -1 0 ? ] ushort-8 new 2map-as half-8-cast ]
}
{
">"
[ [ > -1 0 ? ] ushort-8 new 2map-as half-8-cast ]
}
{
">="
[ [ >= -1 0 ? ] ushort-8 new 2map-as half-8-cast ]
}
{
"unordered"
[
[ unordered? -1 0 ? ] ushort-8 new 2map-as
half-8-cast
]
}
} case ;






























M: object holidays
(holidays)
[ [ clone ] dip ( timestamp -- timestamp ) execute-effect ]
with map ;





























































































































































































































































































M:: object push-value ( stats x -- stats )
stats dup n>> zero?
[ x >>min x >>max ]
[ [ x min ] change-min [ x max ] change-max ] if
[ 1 + dup ] change-n swap :> n [ x + ] change-sum
x over mom1>> - :> delta delta n /f
:> delta_n delta_n sq :> delta_n2 delta delta_n * n 1 - *
:> term1 [
term1 delta_n2 * n sq 3 n * - 3 + * 6 delta_n2 *
stats mom2>> * + 4 delta_n * stats mom3>> * - +
] change-mom4
[ term1 delta_n * n 2 - * 3 delta_n * stats mom2>> * - + ]
change-mom3 [ term1 + ] change-mom2
[ delta_n + ] change-mom1 ;













































M: object resolve-localhost
ipv6-supported?
{ T{ ipv4 { host "0.0.0.0" } } T{ ipv6 { host "::" } } }
{ T{ ipv4 { host "0.0.0.0" } } } ? ;




























































M:: object selection-spans
( start end font string -- spans )
start end [ font string offset>x ] bi@ [ min ] [ max ] 2bi
2array 1array ;

































M:: object selector-do: ( quot receiver -- result )
receiver [ quot ( elt -- result ) call-effect drop ] each
nil ;













































M:: object selector-to:do: ( to quot from -- result )
from to [a..b]
[ quot ( i -- result ) call-effect drop ] each nil ;






M: object selector-value: ( input -- result ) call-effect ;



M: object selector-value:value:
( input input -- result ) call-effect ;



M: object selector-value:value:value:
( input input input -- result ) call-effect ;



M: object selector-value:value:value:value:
( input input input input -- result ) call-effect ;