aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2014-06-02 17:42:12 +0200
committerDrahflow <drahflow@gmx.de>2014-06-02 17:42:12 +0200
commit3acf17796bedc1e9d76d7ebea92071bff2b7d61f (patch)
tree2acc779ae7d5abb594eaec038f9fec8d2a23537a
parenta3e30ac6843c34073ad0423a27f03b27d58981d9 (diff)
Signed integer support
-rw-r--r--elymas/lib/txt.ey6
1 files changed, 6 insertions, 0 deletions
diff --git a/elymas/lib/txt.ey b/elymas/lib/txt.ey
index 2a51f28..9366112 100644
--- a/elymas/lib/txt.ey
+++ b/elymas/lib/txt.ey
@@ -33,6 +33,12 @@
{
_ { [ -01 16 math .base reverse "0123456789ABCDEF" each ] str .fromArray } { -- "0" } ? *
} [ 0 ] [ 0 ] '' /hu deffd
+
+ # 0 -> integer
+ # 0 <- decimal representation as string
+ {
+ _ 0 lt { neg u "-" -01 cat } |u ? *
+ } [ 0 ] [ 0 ] '' /i deffd
> /produce defvd
> /txt defvd