Eduardo Cavazos | 15 Apr 10:57
Picon

Brave new world

Hello,

One of the onions in Factor world (to me anyway) has been the dilemma of 
finding the "one true effect". Even when you find the supposed "one true 
effect", there are still exceptional cases which require an accompanying 
shuffle word.

Another dilemma has been finding a "grand unified theory of stack effects"; a 
sort of philosophy behind the effects which would inform the design of future 
words.

I'm going a different route, embracing the diversity of effects instead of 
rejecting it. The way down this route is to give names to each variant.

The following generic words work on sequences and tables (assocs):

----------------------------------------------------------------------

GENERIC: at ( col key -- val )
GENERIC: of ( key col -- val )

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

GENERIC: grab ( col key -- col val )

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

GENERIC: is ( col key val -- col )
GENERIC: as ( col val key -- col )	! "Store value as key"

(Continue reading)

William Tanksley, Jr | 15 Apr 17:20
Picon

Re: Brave new world

Eduardo Cavazos <wayo.cavazos@...> wrote:
>  One of the onions in Factor world (to me anyway) has been the dilemma of
>  finding the "one true effect". Even when you find the supposed "one true
>  effect", there are still exceptional cases which require an accompanying
>  shuffle word.

>  I'm going a different route, embracing the diversity of effects instead of
>  rejecting it. The way down this route is to give names to each variant.

One problem with this approach is that it dramatically increases
information load, both for reading and writing; and as with the
examples you give, the names are not related to each other, and
there's no reason to /a priori/ choose one over the other.

Another approach -- which I'm not going to advocate, but want to
discuss before we commit to the above approach -- would be to provide
language syntax to allow words to optionally take parameters that
indicate the order of their inputs on the stack, OR to name words so
that their parameters are part of the name (rather than to name them
using arbitrary names).

       TUPLE: planet name radius solar-radius ;
       <planet> :name "Mars" is<col,key,val>
       <planet> 100 :radius  is<col,val,key>
       2000 :solar-radius <planet> is<key,val,col>

The choice of which characters to use to indicate that parameter
ordering is being specified is for the experienced community to
decide, not me (a total newbie).

(Continue reading)


Gmane