Discussion:
"Back & Forth" is back!
(too old to reply)
Hans Bezemer
2024-11-18 17:28:20 UTC
Permalink
This time, we delve into a forgotten way to handle fixed point
arithmetic. Which IMHO deserves to be dusted off now we entered the
64-bit era!



Hans Bezemer
Buzz McCool
2024-11-19 17:48:37 UTC
Permalink
Post by Hans Bezemer
This time, we delve into a forgotten way to handle fixed point
arithmetic. Which IMHO deserves to be dusted off now we entered the
64-bit era!
http://youtu.be/VwPForQL10Y
Thanks again for the free education Hans.

In one of your other videos, you briefly showed a snippet of all the
custom Forth words you have created over the years.

I have a general question of how you and others manage custom words. Do
you "include" all these words when you start up an interactive Forth
session or do you just manually pick an choose what you want to include?

Any other tips on word management would be appreciated.
a***@spenarnc.xs4all.nl
2024-11-20 10:43:35 UTC
Permalink
Post by Buzz McCool
Post by Hans Bezemer
This time, we delve into a forgotten way to handle fixed point
arithmetic. Which IMHO deserves to be dusted off now we entered the
64-bit era!
http://youtu.be/VwPForQL10Y
Thanks again for the free education Hans.
In one of your other videos, you briefly showed a snippet of all the
custom Forth words you have created over the years.
I have a general question of how you and others manage custom words. Do
you "include" all these words when you start up an interactive Forth
session or do you just manually pick an choose what you want to include?
Any other tips on word management would be appreciated.
I'd say that they more properly called library words. They proved
to be useful in one application, and later be useful in other application,
simplifying the coding.

As Chuck Moore explained last international november meeting, he used
blocks for this. He has abandoned the 16 by 64 format, but he is still
numbering these blocks. A same block is loaded from vastly different
circumstances.
In my opinion it is more useful to index the block for it's content.
Instead of
178 constant prime gcd load
I prefer
want gcd
A silly, obvious idea is to use the first line of a block that contain
conventionally the name gcd.

1. sequential search has no disadvantage in practice
2. it is obvious that in this example
most programs don't need gcd
all programs could need gcd
This is typical for library facilities.
3. a block contains source not executable code
4. recursive use of want makes this feature exponentially better
5. obviously it should be idempotent, a word should be compiled once.

This is accomplished by source code less than 1 Kbyte.
It is present in ciforth since 2002.

How source blocks are organized is up to the implementer.
ciforth uses the classical 16 by 64 blocks and indexed by the first line.
After 23 years this simple idea admits a single improvement only,
multiple words loaded with one instruction.
[ I don't want to go into this, but a sequential search is actually
advantageous, organizing blocks with random access via unix `` ar ''
is less powerful. This makes it possible to have a single library
for 16/32/64 window/linux ]

Groetjes Albert
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
Hans Bezemer
2024-11-20 18:30:57 UTC
Permalink
Post by Buzz McCool
Post by Hans Bezemer
This time, we delve into a forgotten way to handle fixed point
arithmetic. Which IMHO deserves to be dusted off now we entered the
64-bit era!
http://youtu.be/VwPForQL10Y
Thanks again for the free education Hans.
In one of your other videos, you briefly showed a snippet of all the
custom Forth words you have created over the years.
I have a general question of how you and others manage custom words. Do
you "include" all these words when you start up an interactive Forth
session or do you just manually pick an choose what you want to include?
Any other tips on word management would be appreciated.
It's actually quite simple:
1. General words I tend to use often go into the compiler;
2. Specialized words are grouped into libraries.

And "1." can be divided in:

1a. Absolute core words, that need to be speedy or cannot be expressed
in other Forth words become primitives;

1b. Core words that are there for e.g. compliancy or expressing
intention that can be coded in Forth, are just ordinary Forth words.

But then 4tH is a special compiler, that does not have a REPL and aims
to strip the dictionary and runtime to a bare minimum when creating turnkey.

Hans Bezemer
Buzz McCool
2024-11-22 15:46:41 UTC
Permalink
... Any other tips on word management would be appreciated.
I found the "Forth Foundation Library": https://github.com/uho/ffl

Is this still widely used? I ask since all the commits are over a decade
old.

Are there other open source Forth libraries available?
minforth
2024-11-22 20:34:27 UTC
Permalink
Some popular libraries:

Wil Baden's toolbelt:
http://www.wilbaden.com/neil_bawd/tool2002.txt

General collection:
https://theforth.net/packages

Numerical math:
https://www.taygeta.com/fsl/scilib.html
Buzz McCool
2024-11-24 23:54:08 UTC
Permalink
...

Thank you for the information!
dxf
2024-11-25 05:24:37 UTC
Permalink
Post by Buzz McCool
... Any other tips on word management would be appreciated.
I found the "Forth Foundation Library": https://github.com/uho/ffl
Is this still widely used? I ask since all the commits are over a decade old.
...
AFAIK it was never widely used. When the question as to why arose on c.l.f,
everyone had an excuse as to why it didn't suit them. The reluctance in
Forth to use others' code goes all the way to Moore himself and extends to
things such as the Standard. Elizabeth comments on the phenomena here:

https://groups.google.com/g/comp.lang.forth/c/t7DjpOZkR9M/m/GZbK41I_NA4J
mhx
2024-11-25 10:00:04 UTC
Permalink
[..]
Post by dxf
Post by Buzz McCool
Is this still widely used? I ask since all the commits are over a decade old.
...
AFAIK it was never widely used. When the question as to why arose
on c.l.f, everyone had an excuse as to why it didn't suit them.
[..]

I use(d) the XML tools of the Forth Foundation Library two years
back. They were a delight to work with.

Normally, I don't use other people's code when I'm deeply
interested in the subject matter but in this case my daytime
job required it. I just wanted to get results, but still with
the option to completely understand the nuts and bolts.

-marcel
Hans Bezemer
2024-12-02 18:14:14 UTC
Permalink
Post by mhx
[..]
Post by Buzz McCool
Is this still widely used? I ask since all the commits are over a decade old.
...
AFAIK it was never widely used.  When the question as to why arose
on c.l.f, everyone had an excuse as to why it didn't suit them.
[..]
I use(d) the XML tools of the Forth Foundation Library two years
back. They were a delight to work with.
Normally, I don't use other people's code when I'm deeply
interested in the subject matter but in this case my daytime
job required it. I just wanted to get results, but still with
the option to completely understand the nuts and bolts.
-marcel
I've ported a couple of members from the FFL, but they're HUGE!
Over 600 lines for an XML library. For comparison: my 4tH preprocessor
is a 100 lines LESS!

I'm sure they're quite powerful, but often I just need some tools that
take the edge off. I'm capable enough to handle whatever comes myself.

So:
https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/lib/parsexml.4th

E.g. I used it in my "Kjots to Gnote" converter.. and at work at several
occasions.

Hans Bezemer
mhx
2024-12-02 20:40:25 UTC
Permalink
On Mon, 2 Dec 2024 18:14:14 +0000, Hans Bezemer wrote:
[..]
Post by Hans Bezemer
I've ported a couple of members from the FFL, but they're HUGE!
Over 600 lines for an XML library. For comparison: my 4tH preprocessor
is a 100 lines LESS!
Who cares. My program using the lib is only 60 lines long.

-marcel

(*
* LANGUAGE : ANS Forth with extensions
* PROJECT : Forth Environments
* DESCRIPTION : Mag_Tool utility
* CATEGORY : Example
* AUTHOR : Marcel Hendrix
* LAST CHANGE : May 28, 2019, Marcel Hendrix
*)


NEEDS -miscutil
[UNDEFINED] -ffl [IF] S" ffl/xis.fs" INCLUDED [THEN]

REVISION -readxml "--- XML reader Version 0.00 ---"

PRIVATES

DOC
(*
Mag_Tool output files contain useful data between the tag
<inductance> and the tag <Windings>.
*)
ENDDOC

-- Setup the reader callback word for reading from file
-- We know the Mag_Tool output files are > 100kbytes in size (no spaces)
:NONAME ( fileid -- c-addr u | 0 )
PAD #1024000 ROT READ-FILE ?FILE
DUP IF PAD SWAP ENDIF ; =: file-reader PRIVATE

: DISPLAY-XML ( c-addr u -- )
0 LOCAL start?
0 LOCAL finished?
R/O OPEN-FILE ?FILE LOCAL handle \ Open the file
XIS-NEW LOCAL xis \ Create a XML input
\ stream on the heap
handle file-reader xis XIS-SET-READER \ Use the xml reader
\ with a file
TRUE xis XIS-STRIP! \ Strip leading and
\ trailing whitespace
\ in the text
\ parse the file
BEGIN
xis XIS-READ \ Read the next token
DUP XIS.ERROR <> OVER XIS.DONE <> AND \ Done when ready/error
WHILE
DUP XIS.START-TAG
= IF 2 PICK 2 PICK S" inductance" COMPARE-NC
0= IF TRUE TO start? CLEAR finished? ENDIF
2 PICK 2 PICK S" L_row" COMPARE-NC
0= IF TRUE TO start? CLEAR finished? ENDIF
2 PICK 2 PICK S" Windings" COMPARE-NC
0= IF CLEAR start? TRUE TO finished? ENDIF
2 PICK 2 PICK S" Layouts" COMPARE-NC
0= IF CLEAR start? TRUE TO finished? ENDIF
start? IF >S CR 2DUP TYPE S> ENDIF
ELSE DUP XIS.TEXT = finished? 0= AND ( print all text )
IF ." = " >S 2DUP TYPE S> ENDIF
ENDIF
XIS+REMOVE-READ-PARAMETERS \ remove the tokens
REPEAT
XIS.ERROR = IF CR ." Error parsing the file." ENDIF
handle CLOSE-FILE ?FILE
xis XIS-FREE ;

: do-job ( -- )
S~ MagApplication "Output.xml" out.xml~ SYSTEM
S" out.xml" DISPLAY-XML ;

:ABOUT CR .~ Try: S" out.xml" DISPLAY-XML~ ;
Hans Bezemer
2024-12-03 12:44:53 UTC
Permalink
Post by mhx
[..]
Post by Hans Bezemer
I've ported a couple of members from the FFL, but they're HUGE!
Over 600 lines for an XML library. For comparison: my 4tH preprocessor
is a 100 lines LESS!
Who cares. My program using the lib is only 60 lines long.
Who cares about your 60 lines, Marcel, who cares..
If you want to count, count. If you don't wanna count - then don't count!

It's not complicated, you know.

Hans Bezemer
a***@spenarnc.xs4all.nl
2024-12-03 12:10:05 UTC
Permalink
Post by Hans Bezemer
Post by mhx
[..]
Post by Buzz McCool
Is this still widely used? I ask since all the commits are over a decade old.
...
AFAIK it was never widely used.  When the question as to why arose
on c.l.f, everyone had an excuse as to why it didn't suit them.
[..]
I use(d) the XML tools of the Forth Foundation Library two years
back. They were a delight to work with.
Normally, I don't use other people's code when I'm deeply
interested in the subject matter but in this case my daytime
job required it. I just wanted to get results, but still with
the option to completely understand the nuts and bolts.
-marcel
I've ported a couple of members from the FFL, but they're HUGE!
Over 600 lines for an XML library. For comparison: my 4tH preprocessor
is a 100 lines LESS!
I'm sure they're quite powerful, but often I just need some tools that
take the edge off. I'm capable enough to handle whatever comes myself.
https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/lib/parsexml.4th
E.g. I used it in my "Kjots to Gnote" converter.. and at work at several
occasions.
My observation with arg.fs were the same. 500 lines versus 2 screens.

ciforth is sufficiently mainstream that I can port ffl to ciforth,
however it is a bit troublesome that it means to turn ciforth in
a fat forth loading virtually most of its library code.

I guess that is the price to pay to be in the company of swiftforth,
mpeforth and gforth.
Post by Hans Bezemer
Hans Bezemer
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
Hans Bezemer
2024-12-03 13:23:15 UTC
Permalink
Post by a***@spenarnc.xs4all.nl
Post by Hans Bezemer
Post by mhx
[..]
Post by Buzz McCool
Is this still widely used? I ask since all the commits are over a decade old.
...
AFAIK it was never widely used.  When the question as to why arose
on c.l.f, everyone had an excuse as to why it didn't suit them.
[..]
I use(d) the XML tools of the Forth Foundation Library two years
back. They were a delight to work with.
Normally, I don't use other people's code when I'm deeply
interested in the subject matter but in this case my daytime
job required it. I just wanted to get results, but still with
the option to completely understand the nuts and bolts.
-marcel
I've ported a couple of members from the FFL, but they're HUGE!
Over 600 lines for an XML library. For comparison: my 4tH preprocessor
is a 100 lines LESS!
I'm sure they're quite powerful, but often I just need some tools that
take the edge off. I'm capable enough to handle whatever comes myself.
https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/lib/parsexml.4th
E.g. I used it in my "Kjots to Gnote" converter.. and at work at several
occasions.
My observation with arg.fs were the same. 500 lines versus 2 screens.
ciforth is sufficiently mainstream that I can port ffl to ciforth,
however it is a bit troublesome that it means to turn ciforth in
a fat forth loading virtually most of its library code.
I guess that is the price to pay to be in the company of swiftforth,
mpeforth and gforth.
Post by Hans Bezemer
Hans Bezemer
My feeling exactly.

IMHO I have a finely knit collection of about 550 libraries. Only twelve
are above 10K source. Four of those are original 4tH programs, three are
ported Toolbelt programs, two from the FFL and the remaining three are
from various other sources, like FSL.

And those who think I chose that cut-off point strategically, 515 are
BELOW 5K.

The idea is that you can pick exactly those functionalities you need, so
you can keep its size DOWN.

Also, the compiler will resolve most dependencies automatically without
pulling in masses of code - and hence creating "fat" executables.

If you have a compiler that doesn't produce turnkey executables, that
may be of lesser importance, but that's another kind of discussion/flamewar.

Hans Bezemer
a***@spenarnc.xs4all.nl
2024-12-03 15:01:23 UTC
Permalink
Post by mhx
[..]
Post by dxf
Post by Buzz McCool
Is this still widely used? I ask since all the commits are over a decade old.
...
AFAIK it was never widely used. When the question as to why arose
on c.l.f, everyone had an excuse as to why it didn't suit them.
[..]
I use(d) the XML tools of the Forth Foundation Library two years
back. They were a delight to work with.
Normally, I don't use other people's code when I'm deeply
interested in the subject matter but in this case my daytime
job required it. I just wanted to get results, but still with
the option to completely understand the nuts and bolts.
60 lines of code is a relatively huge investment.
Imagine that I have to do that using the arg stuff from ffl,
it saves loading an essentially two screen facility, 32 lines.
My calculation is not that I saved the time writing the 500
lines of code of arg.fs.

I hate the professional code attitude.
Instead of using 5 lines to explain what the module is all about,
it comes with a 30 lines copyright message up front.
If I must I tuck this message at the end.
Post by mhx
-marcel
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
a***@spenarnc.xs4all.nl
2024-11-25 12:08:55 UTC
Permalink
Post by dxf
Post by Buzz McCool
... Any other tips on word management would be appreciated.
I found the "Forth Foundation Library": https://github.com/uho/ffl
Is this still widely used? I ask since all the commits are over a decade old.
...
AFAIK it was never widely used. When the question as to why arose on c.l.f,
everyone had an excuse as to why it didn't suit them. The reluctance in
Forth to use others' code goes all the way to Moore himself and extends to
https://groups.google.com/g/comp.lang.forth/c/t7DjpOZkR9M/m/GZbK41I_NA4J
The library is bloated and cumbersome to use.
E.f. handling arguments runs over 500 lines and relies on 4 other files from
the package.
Compare this with handle arguments in ciforth, essentially one screen,
pulling in one screen for fetching c-strings:
------------------------------------------------
( ARGC ARGV ARG[] SHIFT-ARGS ENV ) CF: ?LI \ AvdH B2sep21
"Z$@" WANTED
\ Return the NUMBER of arguments passed by Linux
: ARGC ARGS @ @ ;
\ Return the argument VECTOR passed by Linux
: ARGV ARGS @ CELL+ ;
\ Return the environment POINTER passed by Linux
: ENV ARGS @ $@ 1+ CELLS + ;
\ Find argument INDEX, counting from one. Return as a STRING.
: ARG[] CELLS ARGV + @ Z$@ ;
\ Return POINTER behind the end-0 of the environment.
: ENV0 ENV BEGIN $@ WHILE REPEAT ;
\ Shift the arguments, so as to remove argument 1.
: SHIFT-ARGS ARGV >R
R@ CELL+ CELL+ R@ CELL+ ENV0 R> - MOVE
-1 ARGS @ +! ;
------------------------------------------------
There is an other screen that is loaded by wina ( windows ciforth version)
that is totally different except for the interface, where the index line
reads:
( ARG$ ARGC ARG[] SHIFT-ARGS ) CF: ?WI \ AvdH B1jul10

Maybe this library is tailored to ciforth, but it illustrates that
there are more practical ways. This approach make substantial programs
(ciasdis manx) portable over Linux and MS-Windows.

ciasdis was ported to Apple once with little problems.
I am interested to seeing ciasdis ported using the fll-library and ISO
compliance.

Groetjes Albert
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
mhx
2024-11-25 19:39:38 UTC
Permalink
Post by a***@spenarnc.xs4all.nl
Post by Buzz McCool
... Any other tips on word management would be appreciated.
I found the "Forth Foundation Library": https://github.com/uho/ffl
Is this still widely used? I ask since all the commits are over a decade old.
The library is bloated and cumbersome to use.
E.f. handling arguments runs over 500 lines and relies on 4
other files from the package.
Compare this with handle arguments in ciforth, essentially one screen,
[..]

Let's see you do the same with the XML package, keeping track of
the time you need getting it to work on your Forth vs writing it
from scratch.

-marcel
a***@spenarnc.xs4all.nl
2024-11-26 09:22:05 UTC
Permalink
Post by mhx
Post by a***@spenarnc.xs4all.nl
Post by Buzz McCool
... Any other tips on word management would be appreciated.
I found the "Forth Foundation Library": https://github.com/uho/ffl
Is this still widely used? I ask since all the commits are over a decade old.
The library is bloated and cumbersome to use.
E.f. handling arguments runs over 500 lines and relies on 4
other files from the package.
Compare this with handle arguments in ciforth, essentially one screen,
[..]
Let's see you do the same with the XML package, keeping track of
the time you need getting it to work on your Forth vs writing it
from scratch.
I will pull a Chuck Moore here. Why do I need an XML package?
I do not feel inclined to port a facility I don't need.

I am inclined to add ciforth to the engines for those who
want to use ffl.
Post by mhx
-marcel
Groetjes Albert
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
mhx
2024-11-26 10:34:41 UTC
Permalink
Post by a***@spenarnc.xs4all.nl
I will pull a Chuck Moore here. Why do I need an XML package?
I do not feel inclined to port a facility I don't need.
Standing on its own, that is perfectly reasonable.
Post by a***@spenarnc.xs4all.nl
I am inclined to add ciforth to the engines for those who
want to use ffl.
That is a really good idea.

-marcel
dxf
2024-11-27 04:13:33 UTC
Permalink
Post by mhx
Post by a***@spenarnc.xs4all.nl
I will pull a Chuck Moore here. Why do I need an XML package?
I do not feel inclined to port a facility I don't need.
Standing on its own, that is perfectly reasonable.
Post by a***@spenarnc.xs4all.nl
I am inclined to add ciforth to the engines for those who
want to use ffl.
That is a really good idea.
Alas. Another 'Musk-Zuckerberg' that fizzled out.
a***@spenarnc.xs4all.nl
2024-11-27 10:26:00 UTC
Permalink
Post by dxf
Post by mhx
Post by a***@spenarnc.xs4all.nl
I will pull a Chuck Moore here. Why do I need an XML package?
I do not feel inclined to port a facility I don't need.
Standing on its own, that is perfectly reasonable.
Post by a***@spenarnc.xs4all.nl
I am inclined to add ciforth to the engines for those who
want to use ffl.
That is a really good idea.
Alas. Another 'Musk-Zuckerberg' that fizzled out.
I don't understand this remark.

Groetjes Albert
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
Hans Bezemer
2024-12-03 13:40:10 UTC
Permalink
Post by dxf
Post by Buzz McCool
... Any other tips on word management would be appreciated.
I found the "Forth Foundation Library": https://github.com/uho/ffl
Is this still widely used? I ask since all the commits are over a decade old.
...
AFAIK it was never widely used. When the question as to why arose on c.l.f,
everyone had an excuse as to why it didn't suit them. The reluctance in
Forth to use others' code goes all the way to Moore himself and extends to
https://groups.google.com/g/comp.lang.forth/c/t7DjpOZkR9M/m/GZbK41I_NA4J
Well, she's right! ROFL! I recognize myself in those things, absolutely.

Still, I guess there are at least a hundred "snippets" I converted to
4tH, sometimes working closely together with the original authors (like
Wil Baden (especially when 4tH was in its infancy and not very ANS
compatible) and Ed) to make 'em work.

And I still use these routines very frequently - either because of their
functionality or the abstractions they offer.

From time to time - when I find myself particularly clever, I port the
whole shebang to true ANS Forth, so people have another occasion to show
their negative tendencies online (which kind of takes the fun out of
it). But that's an experience we all share.

I remember somebody published a tiny number formatter online and was
burned to the ground for the most outrageous reasons - while the only
thing the thing did was to reliably add commas at a three digit intervals.

Tip: it helps if you fix them - even if your fixes are of no use to
anyone, rather than to simply barf over 'em like you're an old drunk on
a Saturday night who can't hold his liquor.

Hans Bezemer
Stephen Pelc
2024-11-21 11:29:53 UTC
Permalink
Post by Hans Bezemer
This time, we delve into a forgotten way to handle fixed point
arithmetic. Which IMHO deserves to be dusted off now we entered the
64-bit era!
http://youtu.be/VwPForQL10Y
Hans Bezemer
Nice presentation.

Stephen
--
Stephen Pelc, ***@vfxforth.com
MicroProcessor Engineering, Ltd. - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)78 0390 3612, +34 649 662 974
http://www.mpeforth.com
MPE website
http://www.vfxforth.com/downloads/VfxCommunity/
downloads
a***@spenarnc.xs4all.nl
2024-11-22 13:03:35 UTC
Permalink
Post by Hans Bezemer
This time, we delve into a forgotten way to handle fixed point
arithmetic. Which IMHO deserves to be dusted off now we entered the
64-bit era!
http://youtu.be/VwPForQL10Y
A one screen fixed point:
----------------------
( *s /s fix-scale -fixedpoint- ) \ AvdH C3nov06
WANT ALIAS
8 CELLS 4 - CONSTANT fix-scale \ n represents n.2^-scale.
1 fix-scale LSHIFT CONSTANT 1/1
1 fix-scale 1- LSHIFT CONSTANT 1/2
\ As */ * / but scaled.
: */s >R UM* R> UM/MOD NIP ;
: *s 1/1 */s ; : /s 1/1 SWAP */s ;
\ Most other operators remain the same:
'+ ALIAS +s '- ALIAS -s '*/ ALIAS */s
\ For a RATIO (n/d) return an equivalent scaled NUMBER.
'/s ALIAS rat>s \ By accident.
\ Print a scaled double number
: .mantissa 0 DO BASE @ 1/1 */MOD &0 + EMIT LOOP DROP SPACE ;
: _D.s 1/1 UM/MOD 0 <# #S #> TYPE &. EMIT 20 .mantissa ;
: U.s 0 _D.s ;
--------------------

For ISO replace '+ by ' + or ['] + .
(I can't remember which is which.)

ALIAS gives a new name for an old thing.
In a pinch do
: */s */ ;

WANT signifies that you want ALIAS if it isn't loaded already.
Post by Hans Bezemer
Hans Bezemer
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
Loading...