present: add a ``M\\ callable present``

modern-harvey2
Doug Coleman 2017-12-26 15:45:35 -08:00
parent 1e9b407037
commit d835fd8b82
1 changed files with 8 additions and 1 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008, 2009 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors effects io.pathnames kernel math math.parser USING: accessors effects io.pathnames kernel math math.parser
sequences strings vocabs words ; quotations sequences strings vocabs words ;
IN: present IN: present
GENERIC: present ( object -- string ) GENERIC: present ( object -- string )
@ -27,3 +27,10 @@ M: effect present effect>string ;
M: f present drop "" ; M: f present drop "" ;
M: pathname present string>> ; M: pathname present string>> ;
M: callable present
[ "[ ]" ] [
[ drop "[ " ]
[ [ present ] map " " join ]
[ drop " ]" ] tri 3append
] if-empty ;