Re: [OT] PostLisp, a language experiment
From: Paul E. Bennett (peb_at_amleth.demon.co.uk)
Date: 03/12/05
- Previous message: Pascal Costanza: "Re: |SYMBOL| vs 'SYMBOL"
- In reply to: Duane Rettig: "Re: [OT] PostLisp, a language experiment"
- Next in thread: Duane Rettig: "Re: [OT] PostLisp, a language experiment"
- Reply: Duane Rettig: "Re: [OT] PostLisp, a language experiment"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 12 Mar 2005 13:48:06 +0000
Duane Rettig wrote:
>> >>But the reality is that experienced Forth programmers have very little
>> >>trouble here. Write short definitions, document stack effect, test
>> >>bottom up.
>> > Right. What if I wanted to write longer definitions?
>>
>>
>> Why, to make your code unreadable?
>
> I guess it depends on your definition of short. But if your language
> doesn't allow you to write a definition that is longer than normal,
> without the code becoming unreadable, then that is one mark against
> your language.
Why would anyone want to write longer definitions than is absolutely
necessary.
Take for example the cliche DUP *
This gives you the square of the number at TOS. In certain applications it
might be used a large number of times in different definitions. Hence we
might define:-
: SQUARED (S n -- n^2)
(G n^2 is the resultant of the number n multiplied by itself. )
( Limitations: the number n can be no larger than the square )
( root of an n^2 which occupies all the bits of a cell).
DUP * ;
There is very little cost in doing this as the call structure of Forth was
built in at a very fundamental level and is in common enough usage that
this was the first part of Forth to be considered for opitimisation on any
real machine. Would you have it that we should just include the DUP *
cliche instead of defining and using SQUARED. How much longer does it need
to be?
-- ******************************************************************** Paul E. Bennett ....................<email://peb@amleth.demon.co.uk> Forth based HIDECS Consultancy .....<http://www.amleth.demon.co.uk/> Mob: +44 (0)7811-639972 Tel: +44 (0)1235-811095 Going Forth Safely ....EBA. http://www.electric-boat-association.org.uk/ ********************************************************************
- Previous message: Pascal Costanza: "Re: |SYMBOL| vs 'SYMBOL"
- In reply to: Duane Rettig: "Re: [OT] PostLisp, a language experiment"
- Next in thread: Duane Rettig: "Re: [OT] PostLisp, a language experiment"
- Reply: Duane Rettig: "Re: [OT] PostLisp, a language experiment"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|