Wednesday, October 1, 2008

forth

foxchip
to me

show details Jun 3


Reply


On Jun 3, 1:13 pm, gavino wrote:
> does the ease of using the forth commands grow with time?

For most.

> I have a headache trying to remember them all......it seems like i
> play a guessing game with trying to sort out my calcualtions on the
> stack until I finally get it.....

How many words did you start with?

I started with a Forth that had about 300 words. For the first
year or so I would often code some word and show it to someone
else who would say, "Why didn't you use the word XXXX that already
did that only better?"

I would say, I hadn't learned that word yet!

I have worked with Forth that have between 200 and 500 words and
with Forths that have 20,000 words mostly in the glue to foreign OS.
I never claimed to know very many of those words.

I used to say, and I have heard other people say that they could
write an OS function much faster than they could find the one they
needed in a list of tens of thousands of OS functions each with
very involved descriptions and longs lists of side effects on
many other functions.

There is the rule that most people can only keep about a half
dozen things in their head at once. To learn any natural language
you have to learn thousands of words but to form a thought you
only need focus on a few of them at a time.

Like with everything else learning involves building on what
you have done previously to provide shorter descriptions of things
(make things simpler) by noting what is the same and what is
different than solutions you have already learned.

Besides experience in Forth knowledge of alternate algorithms,
knowledge of your own natural language, and effort hopefully
directed by an expert mentor are generally what define skill
level.

> but a week later I've no clue how i
> even got the word workign...it just does......is thsi normal?

No. Well it is 'normal' for people who fail to learn Forth.

I can look at code I wrote 30 years ago and I like anyone else
I can easily read it. No guessing or feeling clueless is required.
I can pick up a 30 year old listing and it is pretty damned obvious.

I will say that it probably took me a few months to feel that
anyone could easily read the code I was writing or that I could
pick it up decades later and read it perfectly well. And it
does take a little effort to make that habit.

I also say that it wasn't for about another twenty years that
I learned how to make the job of writing and debugging the
code so much easier. I would guess that the majority of the
words I wrote thirty years ago had a total of from six to ten
if-else-thens begin constructs and do-loops. Most fit in about
256 bytes but some were 1K of source in length. I have learned
to write shorter definitions over the years so that the meaning
is just obvious.

I did some analysis of Chuck's cad code a few years ago. The
most common word size was about ten characters. That's not a
ten character name, that's ten characters in a definition.
Obviously with words factored that much they won't have six to
ten levels of if-else-then, begin constructs, do-loops and
case statements in a single definition.

Chuck quit using else saying it made code simpler. 99% of
his definitions have one or less control flow constructs.
But it took him over thirty years of practice to refine his
use of the language into something so simple and productive.
Although there were various accounts of his doing in a day
what a team of C programmers had not been able to do in
many months after he had been using Forth for only a few
years.

I was used to functions going on for pages and pages in other
languages. Forth seemed so different in that definitions
were so much shorter compared to everything else. Since then
I have made my Forth definitions about ten times shorter again.

It takes some time to get the balance needed between code,
stack diagrams, comments, and other documentation needed in
Forth software so that most Forth programmers can read it.

(ok, some people call themselves Forth programmers but they
can't program well enough for other people to read their
code, and the worst failures can't even read code they wrote
themselves. Anyone can write jibberish in English too but it
doesn't mean that no one can communicate using English. It
just means some people have not learned to write an English
sentance or Forth code.)

Best Wishes
Reply

Forward


Mr G
to foxchip

show details Jun 4


Reply


awesome....I heard that before.....microscopic definitions....then I guess you pile them up into an app.......wow...new to me....I am also learnign programming and algorithms I have a lot to learn of course....thank you
- Show quoted text -


On Tue, Jun 3, 2008 at 6:59 PM, foxchip wrote:

On Jun 3, 1:13 pm, gavino wrote:
> does the ease of using the forth commands grow with time?

For most.

> I have a headache trying to remember them all......it seems like i
> play a guessing game with trying to sort out my calcualtions on the
> stack until I finally get it.....

How many words did you start with?

I started with a Forth that had about 300 words. For the first
year or so I would often code some word and show it to someone
else who would say, "Why didn't you use the word XXXX that already
did that only better?"

I would say, I hadn't learned that word yet!

I have worked with Forth that have between 200 and 500 words and
with Forths that have 20,000 words mostly in the glue to foreign OS.
I never claimed to know very many of those words.

I used to say, and I have heard other people say that they could
write an OS function much faster than they could find the one they
needed in a list of tens of thousands of OS functions each with
very involved descriptions and longs lists of side effects on
many other functions.

There is the rule that most people can only keep about a half
dozen things in their head at once. To learn any natural language
you have to learn thousands of words but to form a thought you
only need focus on a few of them at a time.

Like with everything else learning involves building on what
you have done previously to provide shorter descriptions of things
(make things simpler) by noting what is the same and what is
different than solutions you have already learned.

Besides experience in Forth knowledge of alternate algorithms,
knowledge of your own natural language, and effort hopefully
directed by an expert mentor are generally what define skill
level.

> but a week later I've no clue how i
> even got the word workign...it just does......is thsi normal?

No. Well it is 'normal' for people who fail to learn Forth.

I can look at code I wrote 30 years ago and I like anyone else
I can easily read it. No guessing or feeling clueless is required.
I can pick up a 30 year old listing and it is pretty damned obvious.

I will say that it probably took me a few months to feel that
anyone could easily read the code I was writing or that I could
pick it up decades later and read it perfectly well. And it
does take a little effort to make that habit.

I also say that it wasn't for about another twenty years that
I learned how to make the job of writing and debugging the
code so much easier. I would guess that the majority of the
words I wrote thirty years ago had a total of from six to ten
if-else-thens begin constructs and do-loops. Most fit in about
256 bytes but some were 1K of source in length. I have learned
to write shorter definitions over the years so that the meaning
is just obvious.

I did some analysis of Chuck's cad code a few years ago. The
most common word size was about ten characters. That's not a
ten character name, that's ten characters in a definition.
Obviously with words factored that much they won't have six to
ten levels of if-else-then, begin constructs, do-loops and
case statements in a single definition.

Chuck quit using else saying it made code simpler. 99% of
his definitions have one or less control flow constructs.
But it took him over thirty years of practice to refine his
use of the language into something so simple and productive.
Although there were various accounts of his doing in a day
what a team of C programmers had not been able to do in
many months after he had been using Forth for only a few
years.

I was used to functions going on for pages and pages in other
languages. Forth seemed so different in that definitions
were so much shorter compared to everything else. Since then
I have made my Forth definitions about ten times shorter again.

It takes some time to get the balance needed between code,
stack diagrams, comments, and other documentation needed in
Forth software so that most Forth programmers can read it.

(ok, some people call themselves Forth programmers but they
can't program well enough for other people to read their
code, and the worst failures can't even read code they wrote
themselves. Anyone can write jibberish in English too but it
doesn't mean that no one can communicate using English. It
just means some people have not learned to write an English
sentance or Forth code.)

Best Wishes


Reply

Forward


Jeff Fox
to me

show details Jun 4


Reply


> awesome....I heard that before.....microscopic definitions....then I guess
> you pile them up into an app.......wow...new to me....I am also learnign
> programming and algorithms I have a lot to learn of course....thank you

What struck me as very strange about Chuck's programming was that
although he wrote much shorter definitions that I was used to
he didn't accumulate as many of them as I expected. I was expecting
him to pile up a lot of them and he didn't, at least not like me.

But 'alot' is a relative term.

Chuck says that what you remove is more important than what you
add. So while he is accumulating a lot of small definitions he
is also eliminating some of them all the time by refactoring.

Chuck only removes about 1% of waste each week or so. But that
means that his programs end up a lot smaller. I recall at ITV
that some programmers would report that they made their code
5%, 2%, 10% smaller each week while other people would report
that their code was 50% larger each week.

I think this is why Chuck's approach is so different than most
other people and why some people get so upset when Chuck says
that if it isn't a hundred times smaller than C that it isn't
Forth. There's a c.l.f faq that says that Chuck is wrong
about that, because the folks who write their Forth in C
argue that Forth in C is always going to be bigger than just
plain C. Forth covers a lot of ground.
- Hide quoted text -
































> On Tue, Jun 3, 2008 at 6:59 PM, foxchip wrote:
>
>> On Jun 3, 1:13 pm, gavino wrote:
>> > does the ease of using the forth commands grow with time?
>>
>> For most.
>>
>> > I have a headache trying to remember them all......it seems like i
>> > play a guessing game with trying to sort out my calcualtions on the
>> > stack until I finally get it.....
>>
>> How many words did you start with?
>>
>> I started with a Forth that had about 300 words. For the first
>> year or so I would often code some word and show it to someone
>> else who would say, "Why didn't you use the word XXXX that already
>> did that only better?"
>>
>> I would say, I hadn't learned that word yet!
>>
>> I have worked with Forth that have between 200 and 500 words and
>> with Forths that have 20,000 words mostly in the glue to foreign OS.
>> I never claimed to know very many of those words.
>>
>> I used to say, and I have heard other people say that they could
>> write an OS function much faster than they could find the one they
>> needed in a list of tens of thousands of OS functions each with
>> very involved descriptions and longs lists of side effects on
>> many other functions.
>>
>> There is the rule that most people can only keep about a half
>> dozen things in their head at once. To learn any natural language
>> you have to learn thousands of words but to form a thought you
>> only need focus on a few of them at a time.
>>
>> Like with everything else learning involves building on what
>> you have done previously to provide shorter descriptions of things
>> (make things simpler) by noting what is the same and what is
>> different than solutions you have already learned.
>>
>> Besides experience in Forth knowledge of alternate algorithms,
>> knowledge of your own natural language, and effort hopefully
>> directed by an expert mentor are generally what define skill
>> level.
>>
>> > but a week later I've no clue how i
>> > even got the word workign...it just does......is thsi normal?
>>
>> No. Well it is 'normal' for people who fail to learn Forth.
>>
>> I can look at code I wrote 30 years ago and I like anyone else
>> I can easily read it. No guessing or feeling clueless is required.
>> I can pick up a 30 year old listing and it is pretty damned obvious.
>>
>> I will say that it probably took me a few months to feel that
>> anyone could easily read the code I was writing or that I could
>> pick it up decades later and read it perfectly well. And it
>> does take a little effort to make that habit.
>>
>> I also say that it wasn't for about another twenty years that
>> I learned how to make the job of writing and debugging the
>> code so much easier. I would guess that the majority of the
>> words I wrote thirty years ago had a total of from six to ten
>> if-else-thens begin constructs and do-loops. Most fit in about
>> 256 bytes but some were 1K of source in length. I have learned
>> to write shorter definitions over the years so that the meaning
>> is just obvious.
>>
>> I did some analysis of Chuck's cad code a few years ago. The
>> most common word size was about ten characters. That's not a
>> ten character name, that's ten characters in a definition.
>> Obviously with words factored that much they won't have six to
>> ten levels of if-else-then, begin constructs, do-loops and
>> case statements in a single definition.
>>
>> Chuck quit using else saying it made code simpler. 99% of
>> his definitions have one or less control flow constructs.
>> But it took him over thirty years of practice to refine his
>> use of the language into something so simple and productive.
>> Although there were various accounts of his doing in a day
>> what a team of C programmers had not been able to do in
>> many months after he had been using Forth for only a few
>> years.
>>
>> I was used to functions going on for pages and pages in other
>> languages. Forth seemed so different in that definitions
>> were so much shorter compared to everything else. Since then
>> I have made my Forth definitions about ten times shorter again.
>>
>> It takes some time to get the balance needed between code,
>> stack diagrams, comments, and other documentation needed in
>> Forth software so that most Forth programmers can read it.
>>
>> (ok, some people call themselves Forth programmers but they
>> can't program well enough for other people to read their
>> code, and the worst failures can't even read code they wrote
>> themselves. Anyone can write jibberish in English too but it
>> doesn't mean that no one can communicate using English. It
>> just means some people have not learned to write an English
>> sentance or Forth code.)
>>
>> Best Wishes
>>
>

No comments: