[Tutor] forth

Bob Gailer bgailer at alum.rpi.edu
Fri Mar 2 23:54:04 CET 2007


Hilton Garcia Fernandes wrote:
> in python:
>
> print "Hello world!"
>
> 21 bytes. 
>   
True, but the forth program is (as I read it) more equivalent to:

def helloWorld():
    print "Hello World!"

although is says 'resulting in a [sic] executable". Not sure what that 
means, unless the obvious - an .exe file which when run displays "Hello 
World!". In that case 263 bytes is remarkable.
> all the best,
> hilton
>  
> Em Sexta 02 Março 2007 16:48, Kirk Bailey escreveu:
>   
>> Hello world
>>
>> : helloWorld ."Hello World!;
>>
>> that's it.
>>
>> HelloWorld is now part of the language. Now if your language instance
>> lets you compile it down, it will include all functions to create that
>> function, and leave all others out, resulting in a executable. Mine came
>> in at 263 bytes.
>>
>> Microsoft C came in at 47 K.
>>
>> to add 2+ 2:
>>
>> 2
>> 2
>> +
>> .
>>
>> As it uses Reverse Polish Notation and is stack oriented, doing math is
>> rather intresting, different, and novel. It's a novel language. VERY
>> good for controllers giving you maximum program in a small device such
>> as your usuall PIC chip. Really SHINES in this venue.
>>
>> Here's a link to wikipedia:
>> http://en.wikipedia.org/wiki/Forth_(programming_language)
>>
>> But this is python list, so enough of comparitive languages.
>>     
>
>   


-- 
Bob Gailer
510-978-4454



More information about the Tutor mailing list