| ###################################################################### | http://CoSy.com | ###################################################################### | | Tap F1 for Help | First lesson : On a blank line below : tap F12 . tap Enter . write something . tap F11 . __________________________________________________________________________ __________________________________________________________________________ You have now made and saved your first timeStamped notes | Think of CoSy as intelligent paper | | Skip down to bottom of log for most current work | | ====================================================================== | | A ` word in Forth is any non blank string of characters | | \/ \/ \/ | F6 executes the line under the cursor | \/ \/ \/ | | The syntax of Forth is { parse-a-word doIt repeat } | | \/ | Put the cursor on lines below and tap F6 | \/ | s" Hello World " | return a CoSy character list , ie: string . HelloPrize | F6 this to find out your prize ! | 20190510.1322 | s" Hello World " reverse | See ! it was sitting on Top of Stack s" Hello World " rho | ` rho is APL for ` count number of items . | In Forth , a "word" can be any non-blank string of characters delimited by white space | That's why ' s" has to have a blank separating it from the quoted phrase | Forth syntax is simply read-a-word do-it | The word : adds new words to the Forth dictionary ; ends compiling mode : HelloWorld s" Hello World " ; | define the word ' HelloWorld HelloWorld | ( to be saved needs to be added to script HelloWorld i( 7 23 )i take >t0> | Here's an APLish demo t0 dup ' reverse 'm ' cL 'd | execute each line in turn to see R0 dup reverse cL | what Forth CoSy APL vocabulary can do . | NB : vocabulary is case sensitive | | ====================================================================== | | NB : Note the difference between ` and ' . Here are their definitions s" : ` " ?? | make next word into symbol ~ token ~ word | | thus | s" asdf" ` asdf match |>| 1 versus ` ' Help | the address of a raw Reva Forth definintion . To test if a word exists : ' asdf _i | returns address if defined else 0 | I use these a short hand in refering to words . Eg : | ' ?? is the HELP verb . For example : s" : ?? " ?? | Find the definition of ' ?? itself | equivalent to ` ?? :?? | | Historical note : | ` NB , short for Nota Bene == Note Well , was a favorite of Ken Iverson | | ###################################################################### | EVERYTHING IS A LIST ITEMS MAY BE LISTS http://cosy.com/CoSy/4th.CoSy.html#CoSyHeader A DICTIONARY IS A LIST OF 2 LISTS | ( Names ; Values ) The "Root" dictionary is named ` R VOCABULARY on LISTS R rho | APL word "count" # of items in list | raw : i# R ' rho 'm | count each ( monadic ) | used so often , also | rho' same as R { rho } 'm R dnames | names in Root ( ` R ) dictionary . Dnames | names in current dictionary intially the Root ( ` R ) dictionary . | ###################################################################### | | \/ \/ \/ \/ | help sources | \/ \/ \/ \/ | F1 : Basic Help | Tapping the F1 key lists all key shortcuts . | ====================================================================== | | \/ \/ \/ | 4th.Cosy ( F6 ) | \/ \/ \/ | ` help -> ` script0 -> ` IntroHelp -> | Stale . dating back to 2006 . ` examples -> s" ./IntroHelp.txt" F> | read file | /\ /\ /\ | 4th.Cosy ( F6 ) | /\ /\ /\ | | ====================================================================== | | \/ \/ \/ | Raw Reva Forth ( sF6 ) | \/ \/ \/ | One can now stay fairly easily executing at the 4th.CoSy list level using F6 . But tapping shift F6 simply executes raw Forth leaving things on the stack sF6 does not try to output the top item . ` dup Help | Help on Reva word ' see res> blVM ' Help 'm | show help on each word in a string . | Reva help often lists related words at the end of a definition . | I often edit down the ` res contents down to these lists | and then use a line like this to display all the related word . | EXERCISE | Make a word to automate this extraction . s" dup " See | See x86 code for ' dup s" @" Words | words containing s" @" . Note : just in the CoSy context | ======================================================================= | | EVERYTHING is a LIST | | Dictionaries are lists of a pair of lists of associated names and values | This ` text and ` res are items in the ' R root dictionary saved by ctrl_s R rho |>| 2 | ' rho is the APL word for # of items . ' i# is raw count | 3 generic functions | cognates of Forth | : @ Fetch ; : ! Store ; : ' address || | ix i@ i! | ( lst i -- r ) | Raw Indexing | vx v@ V! | ( lst _i -- r ) | indexing by name on dictionaries | Dvx Dv@ Dv! | ( _i -- r ) | same using ' _d dictionary | at at! | ( lst iv -- r ) | top level get and put | TYPES | | simple | | character , byte , strings | s" asdf\qwert.code " | Strings ( bytes ) | since 20180306 | Note that the quote character itself cannot be in a string . | Reva's " uses \ to escape the " character so it can be included in strings . | ' s/" retains that behavior . Thus to get help on ' s" itself use : s/" s\" " ?? | Thus must use s/" \\ " and s/" \" " to embed these chars in strings `( LF CR HT BL )` { ^eval _i } 'm ,/ | basic raw char constants zic s" " match |>| 1 | ' zic is an empty string `( asdf sym )` ` asdf ` sym ,L match |>| 1 | numeric lists | i( 0 1 2 3 )i | integers also | 123 _i | 123 456 2_i | f( 2.28 2 2.e5 )f | Floats also | 3.14 ' _f | 3.14 2. 2_f | Forth variable sigdig sets output decimals . Set in ` script0 | general s" asdf " i( 0 1 2 )i ,L | general lists . this creates a list of 2 items -1 _i i( 0 1 2 )i cL | same a ' ,L but catinates if same type Some numerical examples : 10 _iota 2 _i *i | Put the cursor on this line and tap F6 . See ` res above 10 _iota >t0> | It's "concatinative" we can split it and execute parts 2 _i >t1> | t0 and t1 are convenence variables . t0 t1 *i | See ` examples ` examples -> | < see also | /\ /\ /\ /\ | help sources | /\ /\ /\ /\ | | ======================================================================= | | ###################################################################### | ` TekLogArk -> | 2012 - 2014 | First log notes | text> s" ./CoSy/y2015.txt" >F | save text to file ` TekLogArk Dv@ >t0> s" ./CoSy/y2015.txt" F> >t0> t0 daylncut s" job" con | search for occurace of phrase | s" ./CoSy/y2016.txt" F> s" ./CoSy/y2017.txt" F> text> | VMlf s" | =======" con res> >T0> s" ./CoSy/y2017.txt" >F | ###################################################################### | | \/ \/ \/ \/ \/ \/ \/ \/ | Tek Log | \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ | |\/| MY almost RAW SCRIPT UP TO THIS POINT |\/| s" ./CoSy/y2017.txt" F> s" ./CoSy/y2018.txt" F> | ======================== | Tue.Jan,20190101 | ======================== | Dnames R 1 _at rho' ,L flip dsc ( ` help 0 ) | Something sometime 0ed the key ` help variable . restoring from last TSclone . s" C:/4thCoSy/CoSy/CoSy201812281320.csy" F> str>lst ` help v@ ` help Dv! | -- | s" ./lib/util/misc" F> i1 enc >t0> | remembered I had ' braket to simplfy Pascal triangle step . s" : braket " ?? t0 t0 -1 _at ' + ': i1 braket cL >t0> : a@ aux@ ; | added to ./CoSy/ParameterPushing.f : /\a refs+> (aux) @ dup @ refs- ! ; | like >t0 . replaces value , handles ref count . | AF1 1 _i >a 2 _i /\a AF0 AF> | test of counting & freeing | simple looping of expression xt n times . Must be " self contained " leaving nothing on stack . : nxtimes ( n xt -- ) swap 0 ?do dup xeq loop drop ; | saved to CoSy.f | Now can define PascalTri ( n-1 -- n row Pascal triangle ) : PascalTri i1 enc >a { a@ a@ -1 _at ['] + ': i1 braket cL /\a } nxtimes a> ; | 33 PascalTri | That's the largest triangle before integer overflow . t0 i0 { lfVM s" | " ' ssc 'L : prt ss1st : prt<=l 2p> ['] reverse on2 ss dsc i-1 *i L@ swap cut 2P> ; | ======================== | Wed.Jan,20190102 | ======================== | | In reply to https://twitter.com/_akhmorn/status/1077706349457428480 6 _iota i1 +i .. { _i +i } 'R s" ss1st " ?? | s" : ss " ?? ,L : ss1st ( s0 s1 -- idx ) 2refs+> 2dup >r van --aab r> van search 2drop swap - _i --cab 2refs- ; | renamed ' evI to ' ei | integer empty list . 20190121.2120 0 _iota ei match | fails on empty list . may need special case . ToDo | messed a lot w this tdy 20190121.2236 | 20190122.2033 finally got right | updated in CoSy.f : ss1st ( s0 s1 -- idx ) 2refs+> 2dup >r van --aab r> van search if drop swap - _i --cab 2refs- ;then drop 2refs- ei ; s" a s d a s df " s" |" ss1st rho s" a s d a s df " >t0> s" |" ss rho | 1st | ======================== | Sun.Jan,20190106 | ======================== | | In response to Andreas Bernhard Wagner | https://twitter.com/lowfatcomputing/status/1081922018210131968 : avgf 1p> +/ R@ rho i>f %f 1P> ; : gavg 1p> ['] *f ./ R@ rho i>f 1%f ^f 1P> ; ' *f ./ R@ rho i>f 1%f ^f 10 _iota i1 +i i>f >t0> 2 _fmtnF "bl ' cL 'L ,/ | t0 ' avgf ' gavg 2_i cL ' xeq 'R Yes geometric is good for lots . : avgf 1p> +/ R@ rho i>f %f 1P> ; : gavg 1p> ['] *f ./ R@ rho i>f 1%f ^f 1P> ; 10 _iota i1 +i i>f 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 R0 ' avgf ' gavg 2_i cL ' xeq 'R | note this line applies each fn to R0 ( 5.5000 4.5287 ) | ======================== | Thu.Jan,20190110 | ======================== | | ======================== | Fri.Jan,20190111 | ======================== | | ======================== | Sat.Jan,20190112 | ======================== | ` Fact Dv@ dnames s" C:/4thCoSybk/CoSy/CoSy.csy" F> str>lst >t0> dnames t0 ` morse v@ >t1> https://www.facebook.com/groups/wattsupwiththat/permalink/2172749522777879/?comment_id=2172754256110739&comment_tracking=%7B%22tn%22%3A%22R%2310%22%7D .--. . --- .--. .-.. . / --- ..-. / . .- .-. - .... / -....- / .. - / .. ... / -. --- - / -.-. --- ..--- t1 ` Fact Dv@ ` morse v! res> s" / " VM >T0> `( Fact morse )` Dv@ >t0 T0 { "bl swap cL blVM dae } 'm >t1> t0 dsc ' c>i 'm t1 { rho' ,/ } 'm t1 { t0 swap ['] v@ 'R ,/ } 'm "bl MV | 20190121.1436 s" C:/4thCoSy/CoSy/Furniture.f" F> >t0> rho s" asdf qwer " blVM s" asdf" -1 _i cut "bl VM | ======================== | Fri.Jan,20190118 | ======================== | | in response to Aaron Hsu , Dyalog '18: High-performance Tree Wrangling, the APL Way : https://youtu.be/hzPd3umu78g s" A tree is equivalent to a less or more sparse array . Are there any simple algorithms for operations , eg: to "transpose" , your representations , that is , to interchange order of the nesting ? " | Just a note , with modulo indexing , in CoSy when flipping 2 levels the shorter is replicated to the minimum of the lengths . | found ' i_ same as ' >_ . removed from CoSy.f | : i_ dup 0 i@ swap ref0del ; | raw first item of list . s" i_ " ?? s" : >_ " ?? ,L s" : flip " ?? : flip ( CSob -- CSob ) | Transpose list of 2 lists . | returns list of each item of 1th list w corresponding item of 1st suject | to the minimum length of the 2 lists . | dup @ if ;then | transpose of a simple obj is itself dup i# 0;drop | same for empty refs+> dup 2 _take rho' ,/ ['] min _./ >_ cellVecInit >aux> | ob nbdy i# 0 ?do dup i _nth refs+> aux@ i i! loop refs- aux> ; i( 4 2 3 )i ' _iota 'm >t0> | 2 _take >t0> AF1 t0 t0 flip ' ,/ 'm ,L lst AF0 AF> >t1> rho' t0 2 _take rho' ,/ ' min _./ | t0 ' rho s" _nth " ?? ev flip AF1 (' ') flip ' >t0 AF0 AF> R0 +-splt | 20190203.1412 | | ======================== | Sat.Jan,20190119 | ======================== | | ======================== | Sun.Jan,20190120 | ======================== | | ======================== | Mon.Jan,20190121 | ======================== | continuing above /\ | ======================== | Tue.Jan,20190122 | ======================== | | got ' ss1st working right | s" : VM " ?? | bug with ' VM when tok not found . : VM : toksplt ( str tok -- CV ) | like ' tokcut but deletes the tokens from the cut pieces | cr ." toksplt " ( 2p> tokcut i0 R@ rho ) 2p LR@ swap cL >a> dup R@ ssc dup i# 0if drop cut | appends a- R@ rho ['] cut eachleft 2P> ; s" asdf wqhwerp" s" " VM rho | bug came when ' cut made to disclose singletons . simply needed ' cut\ . | 20190124.2044 | ======================== | Thu.Jan,20190124 | ======================== | | ======================== | Sun.Jan,20190127 | ======================== | | 0812 | s" ./CoSy/y2017.txt" F> text> s" ./CoSy/y2018.txt" >F | ======================== | Mon.Jan,20190128 | ======================== | Just a quick example of the sort of off the cuff uses CoSy's vocabulary is well suited for . I got a a notice with a list of 19 Dem Senators with a suggestion to email them about throwing away CO's electoral college leverage : Senator Bridges, Jeff 26 Democrat 303-866-4846 jeff.bridges.senate@state.co.us Senator Court, Lois 31 Democrat 303-866-4861 lois.court.senate@state.co.us ... To email them all , I pasted the table into my ` res window , then composed the following lines to extract and convert to clean email addrs : res> >T0> | grab and store from ` res window T0 "lf "ht cL csv>lst >T1> | convert to list splitting first on line feeds | then on tabs . See | s" : csv>lst " ?? | | The list now looks like ( ( Senator Bridges, Jeff 26 Democrat 303-866-4846 jeff.bridges.senate@state.co.us ) ( Senator Court, Lois 31 Democrat 303-866-4861 lois.court.senate@state.co.us ) ... ) T1 { 1 _at s" , " VM reverse s" " MV } 'm >t0> | So , now split the 2nd item of each and split on the comma space and reverse | then "ravel" back to string with nothing in between using leading space ( Jeff Bridges Lois Court ... ) T1 { -1 _at s" <" s" >" ,L braket } 'm | take the last item of each and bracket with address delimiters ( ... ) | Now glue each pair of strings together t0 R0 ' cL 'd ( Jeff Bridges Lois Court ... ) | ======================== | Sun.Feb,20190203 | ======================== | | finishing ' flip | 1321 | got diverted again | \/ | | first MidWinter calcs and string partition fns . `( 20181221.1523 20190320.1559 )` sym>str>' >t0> | winter spring : prt ss1st L@ swap take 2P> ; : prt<=f ( str tok -- PaRT_Before_Firstincluding ) 2p> ss1st R@ rho +i L@ swap take 2P> ; : prt>=l 2p> ['] reverse on2 prt<=f reverse 2P> ; : prt>l 2p> ['] reverse on2 prt ; s" 20181221.1523" s" ." ,L >t0> `( prtl prt>=l )` { van find _i } 'm ,/ t1 t1 { t0 0 _at t0 1 _at --bca xeq } 'm | testing them all at once | making list of xt s . testing ref counting \/ | AF1 `( prtl prt>=l )` { van find _i } 'm lst AF0 AF> +-splt rho' |>| : prt>f 2p> ss1st R@ rho +i L@ swap cut 2P> ; : prt>=f 2p> ss1st L@ swap cut 2P> ; : prt<=l 2p> ['] reverse on2 prt>=f reverse 2P> ; : prt>l 2p> ['] reverse on2 prt>f reverse 2P> ; | 20190205.1401 | it occurred to me that I could have used negative ' take | instead of ' cut | 10 _iota -5 _take |>| 5 6 7 8 9 | | Adding this vocabulary to Furniture.f | deleting | : afteri ( str tok -- str ) tokcut 1 _at ; | portion of string after but including tok | : beforei >a> tokcut dsc a> cL ; | portion before but including tok | redefining | : braketed ( str tok0 tok1 ,L -- str ) 2p> dsc afteri R@ 1 _at beforei 2P> ; : braketed ( str tok0 tok1 ,L -- str ) 2p> dsc prt>=f R@ 1 _at prt<=l 2P> ; s" Gilgamesh Athorya ," s" <" s" >" ,L braketed | 20190203.0016 | thinking about making ' '( and ' )' to make lists of xt s | t1 { ^eval _i } 'm ,/ >t1> t1 0 _at t1 1 _at daysdif^ |>| 89 | punted 20181221 ymd>fixed 44 + fixed>ymd _i |>| 20190203 | unfinished . | ======================== | Mon.Feb,20190204 | ======================== | | An example from my personal notes . I was wanting to find the last time | I got water filters for our well . I archive each year's ` text as a .txt file s" dir \CoSyBob\CoSy\y20*.txt /b" shell> nlVM dae >t0> | names of archived notes t0 { s" \CoSyBob\CoSy\" swap cL } 'm >T1> | reappend full dir path | When I split them into ' days , I found something was wrong with years before | 2009 . That's when I added a space to start each dayline . T1 { .. F> daylncut rho cL } 'm | list files and the count of their days . | Here's working thru 2008 s" \CoSyBob\CoSy\y2008.txt" F> >t0> rho | read in . check numbr of chars t0 lfVM >t1> rho | split into lines t1 rho' ,/ i0 =i +/ | Just a check if any are empty . Yes at least 1 is . t1 ' dsc 'm ,/ | take a look at 1st char in each line . see lot of ` | t1 { "bl cL } 'm s" | ==" inb & >t0> | because some lines empty | append blank to each so ' inb won't fail on empty because ' take does . | ' inb returns bool of lines which start s" | ==" ' & turns into indices . "bl t1 t0 at ' cL 'R t1 t0 at! | prefix each of those lines with blank , then store . t1 "lf MV daylncut rho | check now have reasonable number of days . t1 "lf MV s" C:/CoSyBob/CoSy/y2008.txt" >F | ravel back to string & save . | now can check all the archives for any days which contain the phrase ` filter T1 { .. F> daylncut s" filter" con cL } 'm | ======================== | Tue.Feb,20190205 | ======================== | | PeakInter.net effectively down . fileDialog >t0> | browse for file names | combining multiple file names : s" C:/4thCoSy/CoSy|y2016.txt|y2018.txt|y2017.txt|y2015.txt|" -1 _cut s" |" VM >t0> t0 dsc s" /" cL t0 1 _cut ' cL 'R >t0> t0 { .. F> daylncut s" sort" con ,L } 'm s" C:/4thCoSy/lib/alg/hsort" F> Dnames ` script.sort -> needs alg/hsort see hsort t1 dsc van cells/ hsort s" cells/" ?? t1 ' hsorti 'm t1 dsc t1 1 _at i-1 *i ,L ' hsorti 'm lst t1 flip i( 1 -1 )i ' *i aaply flip see hsorti : hsorti rep_ dup van cells/ hsort ; s" aaply" ?? 42677480 o | ======================== | Thu.Feb,20190207 | ======================== | 4 2 swap 2dup - --cab + /mod . . : MGdemo 2p> -f LR@ +f %f 2P> ; f( 1 2 3 )f f( 4. 3 2. )f MGdemo | ======================== | Sun.Feb,20190210 | ======================== | | 1150 | exploring what would be involved in building ' _i and ' _f actions into F6 interpreting | 1620 | back to ' flip problem s" C:/4thCoSy/CoSy/ParameterPushing.f" F> lfVM dae >t0> rho t0 t0 { s" | " cL } 'm >t1> { s" |" prtt1> rho s" ss" ?? s" intv" ?? 2 3 =I " c" type s" at!" ?? : =c ( str char -- bool ) : =c over i# intVecInit >aux ssc i1 swap aux@ swap $.s at! aux> ; i1 15 intVecInit >aux> 7 _i at! aux> s" qeawr;l asdf l; " s" a" over i# intVecInit >aux | i>b ( i n -- bool of length n ) > over o drop aux@ lst s" : =c " ?? s" : c@ " ?? t1 | ,/ c>i t0 s" c>i " ?? t1 t1 0 _at s" | " prtb >_ : _i>b intVecInit >aux> i1 --cba at! aux> ; | ( str tok -- bool version of ' ssc ) : =c over i# intVecInit >aux ssc i1 aux@ --bca at! aux> ; | ======================== | Sun.Feb,20190217 | ======================== | https://twitter.com/CoherentSystems/status/1097259435687317504 | 1526 | clean up | needs alg/hsort : hsorti rep_ dup van cells/ hsort ; ` script.sort -> ^eval ` script.sort Dv@ lfVM ` sort. con forgetsort | ======================== | Mon.Feb,20190218 | ======================== | s" shell" ?? ref s" notepad \\cosy\\ref.txt" shell^ s" .\tmp.txt" F> s" notepad " start | ======================== | Fri.Feb,20190222 | ======================== | s" C:/4thCoSy/CoSy/y2018.txt" F> daylncut s" nxtimes" con 10 16 _rand 4 _partition >t0> | ======================== | Sat.Feb,20190223 | ======================== | SV-FIG on | 1138 | Ting geneology | `( parents children )` (' `( John Charlotte )` `( )` ') ,L >t0> `( Bob )` t0 enc ,L >t1> t1 `( Bob parents )` v@ t1 `( Bob children )` v@ | `( BradNelson https://github.com/flagxor )` | https://en.wikipedia.org/wiki/Boehm_garbage_collector http://www.hboehm.info/gc/#details | I still cannot conceive of using anything other than exact reference accounting for allocating and freeing . And I can't imagine better than maintaining an inventory if 2^n byte slots as Arthur Whitney uses | Ken Thompson disagrees . CoSy has the structures needed to implement generic words recognizing type but currently " left as an exercize" . The CoSy header s" header " ?? | Andreas Wagner | https://github.com/lowfatcomputing https://hackaday.io/lowfatcomputing | hyperstatic | mark smith bind trick | | SamFalvo | see Joe Armstrong & Alan Kay - Joe Armstrong interviews Alan Kay https://youtu.be/fhOHn9TClXY | | --- s" ./IntroHelp.txt" F> >t0> ` IntroHelp Dv@ s" C:/4thCoSy/CoSy/IntroHelpArk20190223.txt" >F R ` IntroHelp vdel | ======================== | Sun.Feb,20190224 | ======================== | | Enhanced info at | s" header " ?? | | Need to make Types clearer . `( sys Types )` Dv@ >t0> t0 dsc "ht ' cL 'd t0 1 _at { fmtI dsc } 'm ' cL 'd t0 1 _at ,/ hex fmtI decimal t0 1 _at s" bool" ?? s" : fmtI" ?? | ======================== | Mon.Feb,20190225 | ======================== | text> lfVM >t0> rho t0 dsc >t1> t1 0 i@ { [ "bl >_ ] literal } xeq _i s" ] " Help s" ] ' '' (create) (header) [ ['] back compile create does> find find-dict findprev header" >T0> T0 blVM { Help s" |--" "lf braket cL } 'm | got kinda fancy . s/" s\" \" " s" : Help" ?? | Replacing old raw forth output def in ./CoSy/Derived.f with | Reva help on Reva word returned as CoSy string | in : Help ( word -- Reva_help_on_Reva_word ) s" help " swap cL forth> ; s" " words> T0 b Help xwords> { [ "bl >_ ] literal } dup . value tst tst xeq s" ] l" ?? | ======================== | Tue.Feb,20190226 | ======================== | Updating Opening help above to use new ' Help def . Was : | --- | \/ | --- | | 20160605.1150 | implemented ' forth> which eliminates regular need for raw Reva Forth execution for getting Reva help . s" see " Help s" help see " forth> | Help on Reva word ' see s" see dup " forth> | See x86 code for ' esi@ s" words @ " forth> | words containing s" @" s" res> Help" forth> | show help on each word in a string . Reva help often lists | related words at the end of a definition . I often edit down the res | contents down to these lists and then sF6 this line to display them all . | --- | /\ | --- | | making ' See like ' Help | added to Furniture.f : See ( word -- assembler_code ) s" see " swap cL forth> ; s" see" See Dv@ lfVM rho' t0 lfVM rho' s" notepad " start s" cs->" ?? | ======================== | Wed.Feb,20190227 | ======================== | macro : ]lit p: ] p: literal ; forth see ]lit { [ "bl >_ ]lit } xeq _i s" macro " Help s" ?literal " ?? : tst char A ; | ======================== | Fri.Mar,20190301 | ======================== | s" : fill " ?? s" fill_" -10 _fill : _fill _i : fill ( l n -- l ) 2p L@ L@ rho i-1 +i R@ iota mini at 2P> ; s" xwords" ?? xwords> { -1 _at } 'm "bl MV blVM reverse | : gfg ( v g f -- v g f g ) | notion of a fork of self inverse ' g | unfinished | s" asdf" ' reverse { 10 _fill } over | ======================== | Mon.Mar,20190304 | ======================== | | One of those minor changes which make a significant difference . | Changing def of ` from making symbol to just making 1 word string . | fns that work on symbols should work on non-blank strings . | See Morten Kromberg's Q at http://cosy.com/CoSy/MinnowBrook2011.html . s" : ` " ?? | : ` : sym ( -- sym | ) | takes next word input and creates symbol | p: parsews (sym) compiling? if refs+> literal, then ; | takes next word input and creates string : ` p: parsews _str compiling? if refs+> literal, then ; s" `( " ?? | similarly | in CoSy.f | ======================== | Tue.Mar,20190312 | ======================== | s" : fill " ?? : _fill _i : fill ( l n -- l ) dup 0 i@ 0 ;then >r reverse r> -1*i fill reverse ; s" negate" ?? see fill s" if is needed . | generalizing ' fill for negatives . developed using ` tstscript : _fill _i : fill ( l n -- l ) dup 0 i@ 0 >if 2p L@ L@ rho i1 -i R@ iota mini at o cr 2P> ;then >r reverse r> -1*i fill reverse ; s" asdf" i( 20 -20 )i ' _fill 'R : tst 0 >if s" true " else s" false " then ; : ;tst 0 >if s" true " ;then s" false " ; -1 dup tst swap ;tst ,L | 1836 | | ======================== | Sat.Mar,20190316 | ======================== | s" : See" ?? s" prior " Help s" asdf" "bl cL 20 _fill rho i( 20 -20 )i | 1648 | | ======================== | Mon.Mar,20190318 | ======================== | Uploading | Saturday's YouTube about ' fill | 1243 | Updated GitHub | https://youtu.be/jJZUg_Hzkf8 | 1549 | Joules is a better unit that watt*hours | ` Fact dup ,L -> lfVM s" watt" con | K | : JpKWh : */ 1000 60 60 />/ 3600000 : J%Ws f1. ; 1. _f J%Ws | *f 1. _f f( 1 60 60 24 7 365.25 )f `( Fact ` Fact Dv@ dnames ` Physics _d dnames ` Fact Dv@ ' _d rplc | 20190318.1924 | !!! | First time I ever tried . appears to work to move to subdirectory | 1925 | ` Fact Dv@ dnames Dnames R ' _d rplc s" rplc " ?? R DMP | 1941 | s" : D" ?? | 1948 | ` Fact Dv@ ' _d rplc | ======================== | Sat.Mar,20190323 | ======================== | | 1202 | Ting https://youtu.be/1RRA5o0Qxxs very interesting talk on adruino HTML interface . s" repeat " Help res> blVM >t0> ' Help 'm t0 ,/ | blVM s" flow-control" Help s" appstart " ?? s" C:/CoSyBob/CoSy/CoSy.csy s" getval " ?? reswdo @ getval >t0> rho _str >t0> rho s" alts" ?? s" ./CoSy/Tui.f" F> ./CoSy/AltStackOps.f" F> f( 1920 1080 )f .. 2. _f ^f +/ sqrtf %f 50. _f *f | thinking of getting a | 50" 4K screen . Wanted edge dimensions . f( 43.5787 24.5130 )f f( 510 285 )f ,L { ['] %f ./ } 'm f( 43.5787 24.5130 )f f( 510 285 )f %f s" : sq" ?? | ======================== | Sun.Mar,20190324 | ======================== | | 2107 | | Another word I found quite useful in K.CoSy | s" C:/CoSy/tmp.txt" F> | main objective to pick out words w ` * in my shopping list . | DRE / from K.CoSy | Delete Redundant ( all but first of sequences of ) Elements x in string y | { ( x = * y ) _ y : y _di & t & 1 ! t : x = y : x , y } s" C:/CoSyBob/CoSy/CoSy.csy" F> str>lst ` ToDo v@ >T0> | my shopping list . res> >T0> T0 "lf "bl ,L ssr "ht "bl ,L ssr >t1> T0 (' "lf "ht ') "bl ' ,L 'L ' ssr Y./ >t1> | factored "bl t1 cL "bl =c >t0> t1 t0 t0 1 _rotate mini 0=i & at R0 blVM s" *" con | ======================== | Mon.Mar,20190325 | ======================== | | ( str chr -- str ) Delete Redundant ( all but first of sequences of ) | Elements x in string y : drb >a "bl a@ cL "bl =c >a> 1 _rotate a> mini 0=i & a> swap at ; | added > Furniture.f t1 drb >t0> t0 blVM s" *" con "bl MV t0 blVM s" +" con "bl MV ,L : drb "bl : dre 2p> swap cL R@ =c >a> 1 _rotate a> mini 0=i & L@ swap at 2P> ; t1 "bl dre | ======================== | Tue.Mar,20190326 | ======================== | | : tst ` asdf ; | bombs . Need general soln for ` state_smart words . | simple variation on ' ssr | added @ CoSy.f : ssd zic ,L ssr ; Dnames fmt ,/ >t0> | used for something like this t0 "lf ` ` ,L ' ssd Y./ drb s" : `" ?? | : tst R `@ T0 ; | bombs : `D@ ( -- val ) p: sym Dv@ ; `D@ T0 | is it worthwhile ? | 20190328.1648 yea , I think so . | ======================== | Thu.Mar,20190328 | ======================== | s" parsews " ?? : ` p: parsews _str compiling? if refs+> literal, then ; s" : char " ?? : char parsews drop c@ ?literal ; : tst char a a _i ; char a _i see tst | 1719 | going to test hiding bottom button row . it causes problems . bye | | | 1812 | No . fails to load . Better to spend time on Job.f | ======================== | Fri.Mar,20190329 | ======================== | Dnames | sym>str>' "bl MV >t0> t0 "bl ss >t1> t1 t1 70 _i _modi ,L | APLish approach to word wrap algo . zic ` SkriptThots Dv! ` SkriptThots -> | removed presentation script from this ` text . s" C:/4thCoSy/lib/string/regex" F> | ^eval s" .contexts" Help xwords> ' dsc 'm t0 80 _partition { "bl MV } 'm ` partition ?? s/" s\" " ?? s" p[ " ?? s" C:/4thCoSy/CoSy/y2018.txt" F> daylncut 1 _cut >t0> s" .r " con `D@ .r `D@ text daylncut s" .r " con ' newwdo | ======================== | Sat.Mar,20190330 | ======================== | | generalizing arbitrary *.csy named files . Example DOS command | to start ` y18.csy residing in ` \CoSyBob\y18\ . ` /k means keep cmd wdo open C:\Windows\System32\cmd.exe /k "\4thCoSy\CoSy@.bat \CoSyBob\y18\y18" s" savedic" ?? | in ./CoSy/SaveRestore.f fixxed backup problem s" ren " COSYSTARTFILE cL s" .csy CoSy.bk" cL >r> van shell r> ref0del COSYSTARTFILE |>| .\CoSy\CoSy | here | to use CoSyFile |>| CoSy s" ren " COSYSTARTFILE cL s" .csy " cL CoSyFile s" .bk" cL cL | 2055 | This makes it much simpler to set set up multple ` Jobs in the K.CoSy sense | but bk to issue of multiple windows . res> >T0> | simplest way to capture a string w embeded ` " and ` \ is copy to T0 |>| "%ProgramFiles%\Windows NT\Accessories\wordpad.exe" | & from ` res T0 `( sys wordpad )` Dv! `( sys wordpad )` Dv@ T0 ` C:\4thCoSy\cosy\y2018.txt cL start s" : start " ?? s" dir cosy" shell> | ======================== | Sun.Mar,20190331 | ======================== | | from K.CoSy | .CoSy.math | http://cosy.com/K/math_a.txt http://cosy.com/K/math.txt http://cosy.com/K/K_math.rtf | K definitions | \/ | pv : { +/ y * x ^ # y } ; pv..h : " Present Value of stream y at rate x " pv:{[c;t;d] +/c*d^t } pv[c:.1 .1 1.1 ; t:1 2 3 ] d:%1.1 / Arthur's example 1.1 _f 1%f f( 1 2 3 )f ^f f( .1 .1 1.1 )f *f +/ | 1312 | | ======================== | Mon.Apr,20190401 | ======================== | | 1958 | somehow trashed ` help . replaced w file downloaded from GitHub . s" C:/Users/Bob/Downloads/CoSy.csy" F> >T0> str>lst ` help v@ ` help Dv! | ======================== | Tue.Apr,20190402 | ======================== | | 1233 | CoSy environment for you to encode your own thoughts . Electronic Paper : `f parsews >>float drop _f ; | ` prefix version of ' _f . added to ` script0 `f 1 | ======================== | Wed.Apr,20190403 | ======================== | f( .1 .1 1.1 )f 1.1 _f 1%f f( 1 2 3 )f ^f *f +/ ( cashflow discountRate time ) f( .1 .1 1.1 )f o 1.1 _f 1%f o f( 1 2 3 )f o ^f o *f o : pv ^f *f +/ ; s" pv " See f( .1 .1 1.1 )f 1.1 _f 1%f f( 1 2 3 )f pv s" +/ " ?? f( .1 .1 1.1 )f 1.1 _f 1%f f( 1 2 3 )f ^f *f ' +f ./ | 1419 |* *| 1445 | | 20190405.1149 | See | https://youtu.be/0fIWQTl_ENU | ======================== | Thu.Apr,20190404 | ======================== | Uploading to GitHub | ======================== | Fri.Apr,20190405 | ======================== | | 1150 | ` script.sort -> s" C:/4thCoSy/CoSy/y2018.txt" F> >t0> | daylncut s" group" con t0 "lf "nl ,L ssr s" ./tmp.txt" >F s" notepad .\tmp.txt" start s" notepad" shell^ s" /" s" \" ,L ssr ; `( sys wordpad )` Dv@ s" /k " cL s" C:/4thCoSy/CoSy/y2018.txt" />\ cL start | s" /" s" \" ,L ssr />\ >t0> rho s" />\ " ?? s" : start " ?? || ` not taking ` /k out of ' start in ./CoSy/Furniture.f || if needed to ` keep , prepend file name withe s" /k " || : start s" start C:\\Windows\\System32\\cmd.exe " swap cL shell^ ; | : start s" start C:\\Windows\\System32\\cmd.exe /k " swap cL shell^ ; | For reasons I don't understand , doesn't work w/o the ` /k | 1439 | | : '( not trivial . | ======================== | Sat.Apr,20190406 | ======================== | | 2203 | | copying from i( 20180512 20180519 20180527 )i & updating | a lot of work | consolidated here . : setsize ( s" XxY" dlgH -- ) swap z" SIZE" swap van zt IupSetAttribute drop ; s" 635x500" `( .r Tui SIZE )` Dv! : getfont ( thndl -- s" " ) z" FONT" IupGetAttribute zcount _str ; : settxt ( str txtH -- ) z" VALUE" --bca van zt IupStoreAttribute _i ; `D@ .r t1 newwdo `( .r Tui hndl )` Dv! `( .r Tui hndl )` Dv@ >t1> `( .r Tui SIZE )` Dv@ t1 0 i@ setsize `( .r Tui FONT )` Dv@ t1 1 i@ setfont `( .r text )` Dv@ t1 1 i@ settxt `D@ .r setWdo `( .r Tui hndl )` Dv@ 1 i@ getfont `( .r Tui hndl )` Dv@ 0 i@ `( .r Tui posXY )` Dv@ lst>stk_ IupShowXY _i `( .r text )` Dv@ `( .r Tui hndl )` Dv@ 1 i@ settxt `D@ .r JobHndl | gettxt `( .r text )` Dv! `( .r Tui hndl )` Dv@ | 0 i@ IupDestroy _i s" JobHndlt " ?? `D@ .r closeWdo s" rpl " s" : closeWdo " ?? `D@ .r setWdo -- : JobHndl s" Tui" v@ s" hndl" v@ ; : JobHndld JobHndl 0 i@ ; : JobHndlt JobHndlt 1 i@ ; : setJobtxt ( text job -- ) 2p> s" text" Dv! LR@ JobHndlt settxt 2P ; `( .r text )` Dv@ s" C:/4thCoSy/CoSy/y2018.txt" F> s" ./CoSy/Job.f" F> R0 `( .r text )` Dv! `D@ .r dup setWdo showWdo `( .r text )` Dv@ `D@ .r JobHndlt settxt `D@ .r showWdo `D@ .r JobHndlt gettxt `( .r text )` Dv! `D@ .r JobHndlt gettxt `D@ .r closeWdo t1 0 i@ getsize t1 1 i@ getfont t1 0 i@ getpos `D@ .r JobHndlt _i | gettxt s" JobHndlt" ?? | 20190504.2201 | -- closeWdo ( Job -- ) s" Tui hndl" blVM v@ >_ IupDestroy drop ; `D@ .r JobHndld closeWdo ' LR@ _i --- : showWdo ( Job -- ) 1p newwdo >a> R@ s" Tui" v@ >a> s" hndl" v! | aux@ is Tui auxx@ is hndl | auxx@ lst aux@ lst cr a@ s" SIZE" v@ auxx@ 0 i@ setsize a@ s" FONT" v@ auxx@ 1 i@ setfont R@ s" text" v@ auxx@ 1 i@ settxt auxx@ 1 i@ a> s" posXY" v@ lst>stk_ IupShowXY _i ; `D@ .r showWdo `D@ .r auxdrop a- 1P ; s" IupShowXY " ?? s" `( .r Tui FONT )` " ^eval ' ^eval _i `( .r Tui posXY )` Dv@ t1 0 i@ swap lst>stk_ IupShowXY _i res> `( .r text )` Dv! `( .r Tui hndl )` Dv@ 0 i@ IupDestroy _i i0 `( .r Tui hndl )` Dv! `D@ .r ` Tui v@ t1 0 i@ IupDestroy _i t1 t1 0 i@ swap lst>stk_ IupShowXY _i drop t0 t1 0 i@ swap lst>stk_ | IupShowXY _i IupShowXY t1 1 i@ gettxt `( .r text )` Dv! s" parse " ?? s/" : \" " ?? i( 1 2 )i tst ' lst>stk . IupGetAttribute t1 0 i@ z" posXY" t1 0 i@ getpos 2_i cL ` getpos ?? 3drop s" >single " Help t1 1 i@ z" " IupGetAttribute `( .r text )` Dv@ | t1 1 i@ settxt t1 1 i@ gettxt >t0> t0 `( .r text )` Dv! `( .r Tui posXY )` Dv@ t1 0 i@ 1000 100 showXY t1 >_ Iupdestroy _i t1 z" FONT" IupGetAttribute zcount _str | 1232 | `( .r hndl )` Dv@ >_ 1000 100 showXY `( .r hndl )` Dv@ >_ `( .r Tui SIZE )` Dv@ van zt setsize `( .r hndl )` Dv@ 1 _at >_ z" FONT" `( .r Tui FONT )` Dv@ van zt IupSetAttribute _i s" showXY" ?? `D@ .r >t0> showWdo t0 ` text v@ t0 `( Tui hndl )` v@ 0 _at settxt | ( str attr wdoHndl -- ) : setwAttr 0 i@ --cab van zt swap van zt IupSetAttribute drop ; s" 635x510" s" SIZE" t1 0 i@ --cab van zt swap van zt IupSetAttribute _i | ======================== | Mon.Apr,20190408 | ======================== | : drb >a "bl a@ cL "bl =c >a> 1 _rotate a> mini 0=i & a> swap at ; s" abc" 1 _rotate | ======================== | Wed.Apr,20190410 | ======================== | s" 2019-02-27 16:40 310 Chase4301.CSV" >t0> drb | problem 2019-02-27 16:40 310 Chase4301.CSV2 "bl t0 cL "bl =c >t1> dup 1 _rotate mini 0=i & >t1> t0 t1 at | ======================== | Thu.Apr,20190411 | ======================== | | I flipped deletion in the K I was translating to complementing and retrieving | would have caused index error in K , but CoSy modulo wraps . | DRE | Definition from K . | Delete Redundant ( all but first of sequences of ) Elements x in string y | { ( x = * y ) _ y : y _di & t & 1 ! t : x = y : x , y } s" dvi " ?? : drb >a "bl a@ cL "bl =c >a> 1 _rotate a> mini & a> swap dvi ; t0 drb | fixed | 2310 | http://cosy.com/K/verbs.csv | ======================== | Fri.Apr,20190412 | ======================== | ` help -> | added K_verbs.csv to distro . "nl "ht ,L delimiters w embedded "lf in defs s" C:/4thCoSy/CoSy/K_verbs.csv" F> "nl "ht ,L csv>lst >T0> rho' | continuing on 0406 | ' showwdo s" C:/4thCoSy/lib/ui/gui" F> s" |||" prt>f >T0> rho T0 s" def:" tokcut "lf ' VM 'L 1 _cut >T1> T1 { 1 _take dsc } 'm | ======================== | Sat.Apr,20190413 | ======================== | | really want to get windows working . continuing @ 0406 | ======================== | Mon.Apr,20190415 | ======================== | s" dosslash" ?? | deleted | : dosslash^ ( str -- str ) { dosslash str } onvan ; | use ' />\ | left raw util.v ' dosslash for now . | ======================== | Wed.Apr,20190417 | ======================== | : fmt$ 18 _fmtnF ; | added to CoSy.f : Pi fpi _f ; | added to Furniture.f Pi 4 _iota i>f *f fmt$ "bl MV | for example | | ======================== | Fri.Apr,20190419 | ======================== | | 1644 | I'd like to see the calculation of the date of ` GoodFriday in ' CoSy | | back to ` .r window @ 190406 | ======================== | Sat.Apr,20190420 | ======================== | f( 315 560 )f 400. 560. 2_f %f *f | resizing YouTube `