The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f4e635c
)
number->string works.
author
Tim Vaughan
<tgvaughan@gmail.com>
Thu, 21 Jul 2016 08:28:58 +0000
(20:28 +1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Thu, 21 Jul 2016 08:28:58 +0000
(20:28 +1200)
scheme-primitives.4th
patch
|
blob
|
history
diff --git
a/scheme-primitives.4th
b/scheme-primitives.4th
index
8e83f97
..
a9ea386
100644
(file)
--- a/
scheme-primitives.4th
+++ b/
scheme-primitives.4th
@@
-65,14
+65,24
@@
; make-primitive integer->char
: build-fixnum-charlist ( num )
; make-primitive integer->char
: build-fixnum-charlist ( num )
- dup 0= if
- nil
- else
- dup 10 / recurse
- rot 10 mod [char] 0 + character-type 2swap
- cons
+ ?dup 0= if
+ [char] 0 character-type nil cons
+ exit
then
then
+
+ nil rot
+
+ begin
+ ?dup 0>
+ while
+ dup 10 mod swap 10 / swap
+ 2swap rot
+ [char] 0 + character-type 2swap
+ cons
+ rot
+ repeat
;
;
+
:noname ( args -- string )
2dup 1 ensure-arg-count
car fixnum-type ensure-arg-type
:noname ( args -- string )
2dup 1 ensure-arg-count
car fixnum-type ensure-arg-type
@@
-81,7
+91,6
@@
dup 0< swap abs ( bool num )
build-fixnum-charlist
dup 0< swap abs ( bool num )
build-fixnum-charlist
- rot drop
rot if
[char] - character-type 2swap cons
then
rot if
[char] - character-type 2swap cons
then
@@
-89,7
+98,7
@@
drop string-type
; make-primitive number->string
drop string-type
; make-primitive number->string
-( = Arithmeic = )
+( = Arithme
t
ic = )
: add-prim ( args -- fixnum )
2dup nil objeq? if
: add-prim ( args -- fixnum )
2dup nil objeq? if