Changeset 28

Show
Ignore:
Timestamp:
02/07/06 17:53:22 (3 years ago)
Author:
krobillard
Message:

Thune - Added reduce.

Location:
trunk/thune
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/eval.c

    r23 r28  
    299299            } 
    300300        } 
     301    } 
     302    // else leave tos unchanged... 
     303} 
     304 
     305 
     306// (value -- [result]) 
     307static void uc_reduce( UCell* tos ) 
     308{ 
     309#if 0 
     310    if( ur_is(tos, UT_BLOCK) ) 
     311    { 
     312    } 
     313    else 
     314#endif 
     315    if( ur_is(tos, UT_PAREN) ) 
     316    { 
     317        UR_CALL_OP = OP_DO; 
     318    } 
     319    else if( ur_is(tos, UT_WORD) ) 
     320    { 
     321        UBlock* blk; 
     322        UCell* val; 
     323 
     324        ur_wordCell( tos, blk, val ); 
     325        ur_copy(tos, *val ); 
    301326    } 
    302327    // else leave tos unchanged... 
     
    12561281{ 
    12571282    { uc_do,           "do" }, 
     1283    { uc_reduce,       "reduce" }, 
    12581284    { uc_set,          "set" }, 
    12591285    { uc_get,          "get" }, 
  • trunk/thune/tests/working/99.t

    r24 r28  
    44 
    55[ 
    6   [first dup string! is-type? iff do prin] 
     6  [first reduce prin] 
    77  [ 
    88    "^/" n " bottles of beer on the wall, " n " bottles of beer.^/"