2009-01-09 18:58:00 -05:00
|
|
|
! Copyright (C) 2008, 2009 Slava Pestov.
|
2008-06-30 04:57:00 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2017-12-28 20:56:38 -05:00
|
|
|
USING: accessors alien.c-types effects io.pathnames kernel math
|
|
|
|
math.parser quotations sequences strings vocabs words ;
|
2008-06-05 01:18:36 -04:00
|
|
|
IN: present
|
|
|
|
|
|
|
|
GENERIC: present ( object -- string )
|
|
|
|
|
|
|
|
M: real present number>string ;
|
|
|
|
|
2015-05-11 20:57:11 -04:00
|
|
|
M: complex present ( c -- str )
|
|
|
|
[ real>> number>string ]
|
|
|
|
[
|
|
|
|
imaginary>>
|
|
|
|
[ number>string ]
|
|
|
|
[ 0 >= [ "+" prepend ] when ] bi
|
|
|
|
] bi "j" 3append ;
|
|
|
|
|
2008-06-05 01:18:36 -04:00
|
|
|
M: string present ;
|
|
|
|
|
2008-06-28 03:36:20 -04:00
|
|
|
M: word present name>> ;
|
2008-06-05 01:18:36 -04:00
|
|
|
|
2009-01-16 13:47:33 -05:00
|
|
|
M: vocab-spec present name>> ;
|
2009-01-09 18:58:00 -05:00
|
|
|
|
2008-06-08 17:47:20 -04:00
|
|
|
M: effect present effect>string ;
|
|
|
|
|
2008-06-05 01:18:36 -04:00
|
|
|
M: f present drop "" ;
|
2012-10-22 22:49:27 -04:00
|
|
|
|
2012-10-22 23:11:11 -04:00
|
|
|
M: pathname present string>> ;
|
2017-12-28 20:56:38 -05:00
|
|
|
|
|
|
|
M: callable present
|
|
|
|
[ "[ ]" ] [
|
|
|
|
[ drop "[ " ]
|
|
|
|
[ [ present ] map " " join ]
|
|
|
|
[ drop " ]" ] tri 3append
|
|
|
|
] if-empty ;
|
|
|
|
|
|
|
|
M: pointer present
|
|
|
|
to>> name>> "*" append ;
|