]> gitweb.factorcode.org Git - factor.git/commitdiff
present: add callable and pointer defs.
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 29 Dec 2017 01:56:38 +0000 (17:56 -0800)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 29 Dec 2017 01:56:50 +0000 (17:56 -0800)
basis/present/present.factor

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