Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: paul graham...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 3744 of 4325
Post > Topic >>

Re: paul grahams arc, a new lisp, and his words about makign code shorter, vs forth?

by Albert van der Horst <albert@[EMAIL PROTECTED] > Feb 2, 2008 at 01:32 PM

In article
<0addbefd-8263-440f-8f1b-284a4bad5f50@[EMAIL PROTECTED]
>,
gavino  <gavcomedy@[EMAIL PROTECTED]
> wrote:
>On Feb 1, 3:34 am, Albert van der Horst <alb...@[EMAIL PROTECTED]
>
>wrote:
>> In article
<15b26bd9-b49e-4f99-bbb0-0ebab2eea...@[EMAIL PROTECTED]
>,
>>
>> Jeff M. <mass...@[EMAIL PROTECTED]
> wrote:
>>
>> <snip>
>>
>> >really a ton of code behind it; nothing magical is going on. With a
>> >similar library in Forth I could easily code the same thing:
>>
>> >  s" Hello, world!" email< m...@[EMAIL PROTECTED]
> send-email
>>
>> With  ``WANT echo'' this is how it looks in ciforth/lina
>>
>> echo 'Hello worlds!' | mail albert@[EMAIL PROTECTED]
>>
>>
>>
>> >It's equally brief, just as readable, and there's just as much code
>> >that exists underneath it, making it possible. In the end, stating
>>
>> You have invented a new syntax. Where Forth is an interpreter, it
>> makes sense to allow using similar commands as a familiar command
shell.
>>
>> The problem is, once you think of it, it is done. This is a simple
>> two screener (one for OS-IM****T and one for the commands im****ted).
>> So maybe Forth is just too easy.
>>
>> OS-IM****T works as follows:
>> If you want to use mail from with Forth, invoking as MAIL :
>>
>> s" mail" OS-IM****T MAIL
>>
>> Implementation is left as an exercise to the reader.
>>
>> <SNIP>
>>
>>
>>
>> >Languages like Lisp and Forth are very good for two reasons: first,
>> >they actively encourage factoring in many ways (which ends up leading
>> >to very readable and terse code at the highest level) and second, they
>> >are extensible, meaning if you really need to add syntactic sugar for
>> >brevity/readability, that's possible as well.
>>
>> >Jeff M.
>>
>> --
>> --
>
>once you think of it , it is done?

Well, let's try it shall we?

S" mail" OS-IM****T MAIL

Apparently OS-IM****T is a defining word, that has a string stored
inside. So we have
: OS-IM****T CREATE HERE OVER CELL+ ALLOT $!
   \ Others may have PLACE or just a word to make a string permanent.
   DOES> ... ;
 No what do we need to fill in for the runtime action?
 We want to fetch that string and append the remainder of the
 line to it, then call the operating system.
 like so
 ... $@[EMAIL PROTECTED]
 PAD $!   BL PAD $C+     ^M PARSE PAD $+!    PAD $@[EMAIL PROTECTED]
 SYSTEM


The second screen is about filling in :

S" edlin" OS-IM****T edit
S" TYPE" OS-IM****T cat
S" COPY" OS-IM****T cp

Caveat, this uses lina mini-strings.
Other Forth's may have different string manipulation words,
sometimes even shortening this.

I hope that you see that I can't get a publication in a peer-reviewed
journal out of this.

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@[EMAIL PROTECTED]
 &=n http://home.hccnet.nl/a.w.m.van.der.horst
 




 2 Posts in Topic:
Re: paul grahams arc, a new lisp, and his words about makign cod
gavino <gavcomedy@[EMA  2008-02-01 15:14:57 
Re: paul grahams arc, a new lisp, and his words about makign cod
Albert van der Horst <  2008-02-02 13:32:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 14:34:56 CST 2008.