Digest #181 2022-04-09

Contributions

[235] 2022-04-08 17:45:25 JimPeterson wrote:

comment - F.3 Seems in Error

The end of F.3 states "Note that all of the tests in this suite assume the current base is hexadecimal.", but then there are tests like:

T{ $12eF       -> 4847        }T

This seems like a contradiction, unless I'm misinterpreting the end of F.3.

--Jim

Replies

[r817] 2022-04-06 09:22:39 AntonErtl replies:

referenceImplementation - Suggested reference implementation

Forth-2012 supports number prefixes, so we can define:

: DECIMAL ( -- ) #10 BASE ! ;
: HEX     ( -- ) $10 BASE ! ;

And actually the number prefixes make DECIMAL and HEX mostly superfluous.

BIN is not a word for setting BASE, BTW.


[r818] 2022-04-06 16:34:58 ruv replies:

referenceImplementation - Possible Reference Implementation

providing a reference for a CORE word that uses words from CORE-EXT may seem invalid

It's not invalid for a reference implementation.

A reference implementation for a word is just an illustration how this word can be implemented, or what algorithm can be used for that.

See also a similar question (and my answer there).