<hosewiejacke>
I'd say most of the time you just use "@".
<inode>
you can also do something like : @MARBLES MARBLE-SIZE * MARBLES + @ ; for accessing array elements
<f-a>
appropriate
<f-a>
thanks
f-a has quit [Quit: leaving]
hosewiejacke has left #forth ["Leaving"]
proteus-guy has quit [Ping timeout: 240 seconds]
proteus-guy has joined #forth
Zarutian_HTC has quit [Ping timeout: 264 seconds]
f-a has joined #forth
<lispmacs>
f-a: I didn't look very closely at your question, but just to mention: it is also possible to define a class with an instance behavior, without using an OO framework:
<f-a>
since the only things I know about polymorphisms come from Haskell
<lispmacs>
then, e.g., you could use the word `marbles' with a length parameter to create a marbles array called `mymarbles', then later call `<index> mymarbles'
<lispmacs>
`10 marbles mymarbles' then `2 mymarbles' later
<f-a>
magnificent
<lispmacs>
it is forths simple way of allowing you to define your own data types similar to `constant' and `variable'
<lispmacs>
the defining and instance behavior could be anything, so you could, e.g., create a data type that represents the memory on another computer chip
<lispmacs>
I'm not sure exactly how you would translate in the idea of multiple class functions, like in OOP. I suppose if you needed to simulate multiple instance behaviors, you could pass in a behavior parameter to switch between behaviors
Lord_Nightmare has quit [Ping timeout: 256 seconds]
Zarutian_HTC has quit [Remote host closed the connection]
<nihilazo>
"starting forth" uses >R and R> in an answer before introducing them in the text
<nihilazo>
:(
<nihilazo>
annoying book
<f-a>
the leo brodie one?
<f-a>
I found it nice to read, interesting regardless of forth
<nihilazo>
yeah, it's what I'm learning forth from
<nihilazo>
it's just being kinda annoying, using words in answers it didn't introduce in the chapter those questions are in
<f-a>
ditto
<MrMobius>
using a thing before you explain it can also be a teaching technique ;)
<nihilazo>
it uses R> in an answer in chapter 4 then only teaches R> in chapter 4
Lord_Nightmare has joined #forth
<f-a>
MrMobius: works when you have a tutor near you imho
<f-a>
with a book it is annoying
<f-a>
before the internet: blocking
<MrMobius>
sometimes they're trying to get you to ask yourself what it is and guess what it's doing so when they explain it youre primed
<f-a>
whoever wrote that test suite thingo needs a statue
<veltas>
I worked through Starting FORTH first, and do not remember this.
dave0 has quit [Quit: dave's not here]
Zarutian_HTC has joined #forth
<veltas>
nihilazo: Do you mean the answer to chapter 4 part 6, where it gives an answer without >R/R> and then one that does use them saying it's "a more efficient version, using tricks introduced in the next chapter"
<veltas>
nihilazo: Oh right yeah the web version is bad, use the scanned PDF
<veltas>
I am not surprised stuff is broken on the web version, I don't know if Brodie was even involved in the ANSI changes
<f-a>
I wonder on how popular ANS Forth was
<veltas>
I think ANS Forth 94 was a better standard than Forth 2012, except for environment query strings
<nihilazo>
veltas: OK I'll grab the scanned PDF
<nihilazo>
is it on forth.com too?
<nihilazo>
the first edition
<nihilazo>
yes, it is. OK, grabbing it
<veltas>
Yes I think so
<veltas>
Not that much stuff is outdated, and the places where things have changed are a bit of history and interesting
<veltas>
The bit on the block editor is probably worth skipping or skimming
<veltas>
I skimmed it anyway
<nihilazo>
ok
<nihilazo>
I find it interesting that a lot of earlier texts seem to consider forth an OS as well as a language
<nihilazo>
I assume that's in a similar way to BASIC being both OS and langauge on many earily home computers?
<veltas>
Some people still describe Forth as an OS
<veltas>
There isn't really a good definition of "OS" anyway, not in my opinion. Forth might as well be an OS
<MrMobius>
nihilazo, yes like BASIC
<nihilazo>
ok
<nihilazo>
actually I do know one early home computer that did come with forth rather than basic, the jupiter ace
<nihilazo>
sadly it didn't seem to be very successful, they're super rare now
<veltas>
Anything that runs on an older system and has general purpose programming + editor is essentially an OS
<nihilazo>
I love the illustrations in starting forth
<nihilazo>
the 2-headed SWAP dragon especially
shmorgle has joined #forth
<nihilazo>
and the executioner etc. It has a fun vibe that I rarely see in programming books, even ones that are trying to be fun
crc has quit [Remote host closed the connection]
<nihilazo>
it feels like it's just the author understanding fun ways to illstrate concepts rather than an author trying to put jokes into an otherwise boring programming book
<f-a>
↑
dnm has quit [Ping timeout: 264 seconds]
dnm has joined #forth
<nihilazo>
are I, I' and J old? I notice the web version has R@ instead
<veltas>
Yes and no
<veltas>
I and J are now not necessarily the 1st and 3rd return stack items
<veltas>
In the standard
<nihilazo>
ok
<veltas>
I' is not in the standard
<veltas>
You can tell why I and I' are the top and 2nd of return stack, because that's where the iterator and limit are retained on the original forths
<veltas>
The standard generally tries to assume less about e.g. return and control stack layout
<nihilazo>
ah, i is the iterator
<nihilazo>
that makes sense
<nihilazo>
and r@ is the top of the return stack
<f-a>
: a ( n n -- ) 0 do 0 do i j . . key loop loop ;
<f-a>
this loops infinitely, what am I doing wrong?
<veltas>
You haven't supplied a limit
<veltas>
Oh wait you have
<f-a>
(invoke it with `2 3 a`)
<veltas>
Yes sorry I always half-ass reading your code my bad :P
<f-a>
no worries
<veltas>
Okay the limit isn't supplied to the inner loop correctly
<veltas>
You need to retain it somehow for later loops
<veltas>
It's consumed the first major loop
<nihilazo>
is fixed point still the preferred math in forth even though we now have hardware FP on basically every modern machine?
<nihilazo>
like, if you are programming for a machine with hardware floating point
<nihilazo>
(well, "basically every modern machine", modern desktop platforms)
<veltas>
It's *faster* to do FP on many machines now
<veltas>
For embedded systems without an FPU often floating-point calcs would be extremely bloated
<remexre>
also if you're an ideologue like me, you might not want the default non-integer math to have negative zero and nan :P
<nihilazo>
so how does floating point work in forth?
<veltas>
There are floating point words in the standard
<veltas>
Optionally the floating point numbers get their own stack
<f-a>
: prova 3 3 0 do 0 do i j . . key cr loop loop ;
<f-a>
sorry mispaste :P
<nihilazo>
ah ok, pforth also has a seperate float stachpk
<nihilazo>
s/stachpk/stack/
<nihilazo>
is it still worth reading the chapter on fixed point even if floating is faster on modern desktop platforms
<nihilazo>
actually the answer is "yes" because I probably will be programming forth on 8bit machines etc
<f-a>
oh veltas
<f-a>
now I see my error
<f-a>
tricky
<MrMobius>
nihilazo, cool that youre doing 8 bit stuff. which machine(s)?
X-Scale` has joined #forth
<nihilazo>
probably c64?
<MrMobius>
awesome
<nihilazo>
I want to program for the c64 and forth seems like a nice step up from asm while still being able to use asm for stuff
<nihilazo>
when it needs to be super quik
<nihilazo>
s/quik/quick/
<nihilazo>
I don't even have a c64, I'm using an emulator, but I want to program for an 8-bit machine for the sake of learning
scoofy_ has joined #forth
scoofy has left #forth [#forth]
<MrMobius>
there is a subroutine threaded forth called TaliForth2 that runs on the newer 65C02, so not c64 compatible, but it's a neat thing to practice on. I have an emulated version on my website you can play with in the browser: http://calc6502.com/Simulators/TaliForth2/main.html
X-Scale has quit [Ping timeout: 272 seconds]
X-Scale` is now known as X-Scale
<MrMobius>
subroutine threaded being generally the fastest but largest size model of forth
scoofy_ is now known as scoofy
<veltas>
I would like to think it wouldn't be *that* heavy on 6502 comparitively, since 6502 itself is so verbose