Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #36154

Re: Attila Forth compiler

From "Alex McDonald" <blog@rivadpm.com>
Newsgroups comp.lang.forth
Subject Re: Attila Forth compiler
Date 2015-01-30 15:40 +0000
Organization A noiseless patient Spider
Message-ID <mag8ji$inc$1@dont-email.me> (permalink)
References <mae51a$5hb$1@dont-email.me> <maedn9$8rs$1@dont-email.me> <mag8d2$hmp$1@dont-email.me>

Show all headers | View raw


on 30/01/2015 15:36:34, "Alex McDonald" wrote:
> on 29/01/2015 22:54:37, "WJ" wrote:
>> Gerry Jackson wrote:
>>
>>
>>> I stumbled across the web-site below.
>>> Searching comp.lang.forth on Google Groups
>>> for Attila found nothing so people may not
>>> be aware of this system and may find it of
>>> interest.
>>>
>>>
>>> http://www.threaded-interpreter.org/manual/book/attila.html
>>
>>
>>
>> Attila Forth seems much more powerful than ANS Forth.
> 
> What makes you think that? Did you read the document? It states "It
> adheres closely to the Forth language standard promulgated by ANSI."
> 
>>
>>
>> MAP( xt elem -- )
>>
>> Destructively map the word xt over the elements of the list
>> from elem, replacing each element with the result of executing
>> xt with the previous value on the top of the stack.
>>
> 
> These are just words the author of Attila has provided to operate on
> doubly-linked lists. They are not inherent to the language.
> http://www.threaded-interpreter.org/manual/book/sec_words_lists.html
> 
> Here's an ANS Forth version of a list iteration:
> 
>: iterate   ( i*x node iterator -- i*x' )
> \ iterate over a linked list of nodes

I managed to trim the comment, sorry.

\ applying the xt 'iterator' to each node in turn

> >r
> begin ?dup
> while
> r@ over @
> >r execute r>
> repeat r> drop ;
> 
> ITERATE is more generic and more useful than MAP, in that it allows a
> wider range of results than just replacing each element as in MAPs
> case. ITERATE can be used to build Attila's FOLDR and FOLDL and a wide
> range of other "higher order list operations".
> 
> (As an aside, I'd argue that the author has got the operands MAP ( xt
> elem -- ) the wrong way round; you're more likely to be operating with
> elem on the top of the stack before wanting a MAP, so requiring a SWAP
> to get the XT in the right place.)
> 

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Attila Forth compiler Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-01-29 20:27 +0000
  Re: Attila Forth compiler "WJ" <w_a_x_man@yahoo.com> - 2015-01-29 22:54 +0000
    Re: Attila Forth compiler "Alex McDonald" <blog@rivadpm.com> - 2015-01-30 15:36 +0000
      Re: Attila Forth compiler "Alex McDonald" <blog@rivadpm.com> - 2015-01-30 15:40 +0000
  Re: Attila Forth compiler anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-01-30 15:56 +0000
    Re: Attila Forth compiler Richard Owlett <rowlett@cloud85.net> - 2015-01-30 11:09 -0600
    Re: Attila Forth compiler "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-01-31 02:58 -0500
      Re: Attila Forth compiler anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-01-31 11:48 +0000
  Re: Attila Forth compiler visualforth@rocketmail.com - 2015-01-30 08:42 -0800
    Re: Attila Forth compiler "Alex McDonald" <blog@rivadpm.com> - 2015-01-30 17:16 +0000
    Re: Attila Forth compiler Richard Owlett <rowlett@cloud85.net> - 2015-01-30 11:19 -0600
  Re: Attila Forth compiler Christopher Douglas <christopherdouglas35@gmail.com> - 2015-01-31 06:29 -0800

csiph-web