Re: [colorforth] if then else - but why is there no ‘else’ in colorForth?
- Subject: Re: [colorforth] if then else - but why is there no ‘else’ in colorForth?
- From: Nick Maroudas <alice@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Oct 2008 14:33:15 +0200
Dear Jason,
This discussion has given me the confidence to improve
some recent "iffing" in my program. But I must confess
that, as a humble hobbyist, I cannot follow any
language
in the abstract (not even my native Anglisch; after
70 years I still cannot tell what parts are grammar and
what parts are syntax). The same with CF: I know what I
want my hardware to do, I look for suitable words in
CF, like if and then, and test them with simple
numerical examples until the combine to do what I want.
"Simple" can be deceptive, as you say, and take hours;
but there are no hidden paths and everything (that I
can understand) lies nicely to hand. The factoring that
you mention is part of the charm: using 2 stubby little
words instead of 1 big portmanteau word (like the
difference between modern Enlish and classical Greek).
What I really need to understand (in a practical way) is
all those words in CF05 re USB, or some Tim /Ray
/Howerd blocks on networking. I don't mind floppy r/w
being slow; but I have 2 computers, each running CF,
but neither will read the other's floppy.
However, they can read each other's memory cards. At
present I transfer the one floppy to USB stick (via
Linux dd) then take this stick over to the other
computer and there build a new floppy (again via Linux
dd) which the other computer can then r/w and boot
from. I guess CF can r/w/boot from USB in principle
(and from net also?), but I fear that I might not have
enough hours /days /months /years ahead of me to work
out how. I am always happy pass on my own little stock
of tips and annotations (eg, on PCI). If any CForther
here has some tips on USBoot, then I would be glad to
ponder them; else I shall just have to hope that my new
floppy drive lasts.
Caritas,
Nick
Quoting Jason Kemp <jason.kemp@xxxxxxxxxxxxxxxx>:
>... " Hi Nick
>... " [snip]
>... " Not quite what I mean. This is so hard to
>... " explain and I have spent
>... " literally hours over this. I have never given
>... " ‘if’s any thought in
>... " other languages. Who says colorForth is
>... " simple?
>... "
>... " [snip]
>... " Now I am beginning to see that colorForth
>... " encourages all sorts of
>... " ‘factoring’ and also that you are not restricted
>... " by rules. Yours is an
>... " example of this in that what happens if the
>... " first ‘if’ executes (ie. if
>... " ZF=1) changes what the second ‘if’ does to
>... " achieve the effect you want.
>... " I'm looking for something that makes the two
>... " parts (what goes when ZF
>... " set and what when it isn’t) independent and then
>... " allows more to follow
>... " within the same word definition. My colorForth
>... " understanding is so
>... " limited that I have no examples and I am unable
>... " to contrive something
>... " satisfactory either. I'm ignoring recursion at
>... " the moment too.
>... "
>... " What I wonder now though is if I will find, with
>... " more experience, that
>... " there is no need for an if-else-then construct;
>... " I suspect there might
>... " be no ‘else’ because Mr Moore has no need for
>... " it. Also you have not
>... " needed it yet.
>... " > [snip] I think that the way
>... " ‘if’ works precludes
>... " having multiple ‘then’s: the action is to jump
>... " to the ‘then’ if the ZF
>... " is set, so having two ‘then’s means you can only
>... " jump to the first, the
>... " second being ignored. I haven't looked at how
>... " the compiler works yet,
>... " but I would expect that this would cause a stack
>... " underflow during
>... " compilation, yet a simple example I tried
>... " compiled fine.
>... "
>... "
>... " Still perplexed,
>... " Jason
>... "
>... "
>... "
---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com