Changeset 414 for branches/thune

Show
Ignore:
Timestamp:
06/16/07 22:57:19 (17 months ago)
Author:
krobillard
Message:

Added replace.all helper.

Location:
branches/thune/thread_safe
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/thune/thread_safe/boot.c

    r408 r414  
    9696  "  ser [dup first comb do 1 poke drop] iter\n" 
    9797  "] 'loop func :map     ;(ser comb -- )\n" 
     98  "[ser old new | len] [\n" 
     99  "    old length? :len\n" 
     100  "    ser old find if/keep (new len change :ser recurse)\n" 
     101  "    ser\n" 
     102  "] func :replace.all     ;(ser old new -- ser)\n" 
    98103  "[reduce to-text console.out] proc :prin  ;(val -- )\n" 
    99104  "[reduce [first to-text console.out] iter] proc :prin.pack  ;(val -- )\n" 
  • branches/thune/thread_safe/doc/UserManual

    r378 r414  
    374374third       (ser -- val)            Fetch third value in series. 
    375375last        (ser -- val)            Fetch last value in series. 
     376change_     (ser new -- ser)        Change series. 
     377change_     (ser new part -- ser)   Change part of series. 
    376378find        (ser pat -- ser)        Find pattern in series. 
    377379find.last   (ser pat -- ser)        Find pattern in series starting from end. 
     
    384386~~~~~~~~~~~~~~ 
    385387 
    386 ==========  ======================  ================= 
    387 Word        Stack Usage             Function 
    388 ==========  ======================  ================= 
    389 empty?      (ser -- logic)          Same as tail?. 
    390 appen       (ser val -- )           Append and drop. 
    391 map         (ser comb -- )          Transform each element of a series. 
    392 split-path  (full -- path file)     Split full path into path & file. 
    393 dirize      (str -- str)            Ensure trailing slash is present. 
    394 ==========  ======================  ================= 
     388===========  ======================  ================= 
     389Word         Stack Usage             Function 
     390===========  ======================  ================= 
     391empty?       (ser -- logic)          Same as tail?. 
     392appen        (ser val -- )           Append and drop. 
     393map          (ser comb -- )          Transform each element of a series. 
     394split-path   (full -- path file)     Split full path into path & file. 
     395dirize       (str -- str)            Ensure trailing slash is present. 
     396replace.all  (ser old new -- ser)    Find & Replace  
     397===========  ======================  ================= 
    395398 
    396399 
     
    529532 
    530533 
     534change 
     535------ 
     536:: 
     537 
     538        (ser new [part int!] -- ser) 
     539 
     540Change series at current position. 
     541Returns *ser* at end of change. 
     542 
     543 
    531544match 
    532545----- 
  • branches/thune/thread_safe/mkboot.t

    r408 r414  
    110110] 'loop func :map     ;(ser comb -- ) 
    111111 
     112 
     113[ser old new | len] [ 
     114    old length? :len 
     115    ser old find if/keep (new len change :ser recurse) 
     116    ser 
     117] func :replace.all     ;(ser old new -- ser) 
     118 
     119 
    112120[reduce to-text console.out] proc :prin  ;(val -- ) 
    113121[reduce [first to-text console.out] iter] proc :prin.pack  ;(val -- )