Mar-31-2018, 06:16 PM
Forth can be hard to read, or it can read like English if you plan carefully. and is easy to figure out if you're used to it. And it's not as hard to read as Lisp. I've done large-scale Windows desktop apps with Forth !! And, as an aside, somebody on this forum was trying to use Python to format numbers a special way (make 3360 look like b’\x0D\x20′) and couldn't figure it out. Neither could I. But here it is in a Forth word I wrote to test it. No extra libraries needed, no includes, no docs to pour over:
: >HEXF ( n — addr cnt )
BASE @ >R HEX 0
<# ”’ HOLD # # ‘x’
HOLD ‘\’ HOLD # # ‘x’
HOLD ‘\’ HOLD ”’
HOLD ‘b’ HOLD #>
R> BASE !
;
\ run and output:
3360 >HEXF CR TYPE
b’\x0D\x20′
I'm not saying Forth is better or anything... I just wanted to share in case anybody was interested in the 'Forth' discussion branch here.
: >HEXF ( n — addr cnt )
BASE @ >R HEX 0
<# ”’ HOLD # # ‘x’
HOLD ‘\’ HOLD # # ‘x’
HOLD ‘\’ HOLD ”’
HOLD ‘b’ HOLD #>
R> BASE !
;
\ run and output:
3360 >HEXF CR TYPE
b’\x0D\x20′
I'm not saying Forth is better or anything... I just wanted to share in case anybody was interested in the 'Forth' discussion branch here.