projects
/
rrq
/
jonasforth.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handle newlines (in both input and output)
[rrq/jonasforth.git]
/
sys.f
diff --git
a/sys.f
b/sys.f
index d222320fcfe931fcf5e54db18749ae045ba4fbc0..0815e0fe0ca89d729a068e5072a4e8b721635460 100644
(file)
--- a/
sys.f
+++ b/
sys.f
@@
-62,18
+62,6
@@
EXIT [
: MOD /MOD SWAP DROP ;
: NEG 0 SWAP - ;
: MOD /MOD SWAP DROP ;
: NEG 0 SWAP - ;
-: FIB ( n -- Fn )
- 0 1 ( n a b )
- 0 ( n a b i )
- BEGIN
- ROT ( n i a b )
- DUP ROT + ( n i b a+b )
- ROT ROT ( n b a+b i )
-
- 1 + ( n b a+b i+1 )
- DUP 4 PICK = UNTIL
- DROP SWAP DROP SWAP DROP ; ( a+b )
-
: C,
HERE @ C!
HERE @ 1 +
: C,
HERE @ C!
HERE @ 1 +
@@
-89,16
+77,13
@@
EXIT [
1 - DUP 0 = UNTIL
DROP DROP ;
1 - DUP 0 = UNTIL
DROP DROP ;
-S" HELLO-ADDR" CREATE
-S" Hello!" DUP ROT
-STORE-STRING
-: HELLO
- ' HELLO-ADDR LIT, TELL NEWLINE ;
+: NEWLINE 10 EMIT ;
+: SPACE 32 EMIT ;
-HELLO
+( Read a number from standard input. )
+: READ-NUMBER READ-WORD PARSE-NUMBER ;
-S" 10 FIB = " TELL
-10 FIB .U
-S" (Expected: 59)" TELL NEWLINE
+S" Ready." TELL NEWLINE
-TERMINATE
+( vim: syntax=forth
+)