|
CoSy-NoteComputing
Update
|
|
|(| 20110410 |)|
An uptick in interest in my CoSy
environment prompts me to resuscitate my cosy-notecomputing
Yahoo group which was last posted to 20020124 . Yahoo email
groups continue to have a nice bundle of features and interim
mechanisms have been too much of a pain . If you are
interested in , make sure you're on the mail list .
Or follow me on Twitter
for occasional links and thoughts . |
CoSy
The goal of CoSy is a
minimal open vocabulary
building from a simple stack
processor to an executable-at-a-keystroke crystalline notation
on finite data . The purpose is not the language per se . Rather , it
is to artificially aid my intelligence .
And dealing with family financial wellbeing can use all the
intelligence I can muster .
4th.CoSy
Here's a recent example of what I can do in Reva.CoSy
because the IUP
gui communicates with the Windows ClipBoard that I can't do
in K.CoSy
. I simply copied the line below from an email .
3.3 million to buy back and retire
182,600 shares
and edited and executed it as below :
3.3e6 182600. f/
f.
| tapping F6 executes as FORTH with
output to ' res window
18.07228
| tapping F5 inserts ' res
at cursor
Since it's a simple scalar computation , it's simpler to just use the
primitive Reva.Forth ( Intel ) floating point instructions .
Both of the following work In current 4th.CoSy
:
f( 3.3e6 182600. )f ' f/ acrossf
lst
f( 3.3e6 )f f( 182600.
)f /f
lst
There is a LOT of work and some significant problems still to be
surmounted in Reva.CoSy . There
have even been significant upgrades in Reva and IUP which I've not kept
up with .
I'm heading toward
% / 3.3e6 182600
3.3e6 % 182600
where each word decides what to do with itself which is
generally to evaluate the sentence to the left , stack the result , and
check whether the word to the right says it should stack itself or
apply
itself to the result of evaluating the rest of the sentence .
K.CoSy
I've been pleasantly surprised by recent confirmation that the K.CoSy
download is fairly easy to get up and running . I see from Jan
Karman's article on bond valuation
that the
electric K gui apparently is still in use
. His code
looks like K as I know it but is claimed to be Q
. K.CoSy is in circa
2002 evaluation K . I'm not sure whether
it runs in Q because I got the impression Q
did not retain the open K-tree
recursive dictionary structure , and furthermore , it became
clear that I could only achieve the tool I envisioned rolling my own
from open Forth up with total control over the
interface .
But for taking care of family accounting , which includes a trust and a
guardianship and several properties and related party loans , K.CoSy
is my tool . It may still be the only interactive workspace
environment constructed within the K-tree gui .
Given the arbitrary scalability of K , it may have
significant commercial potential particularly in financial modeling and
accounting . I'd be interested in any ideas . The value may range
beyond finance . My attraction to APL
, and most important uses from the beginning have been
scientific
. Here are my notes from a quintessential example from
the APL89
conference in New York :
Astrophysical APL - Diamonds in
the Sky , Schneider, Paluzzi, & Webb :
Members of the Space Telescope group
present the physics of carbon white
dwarf stars in half a dozen short APL
functions.
The question has come up whether the interactive workspace
environment is really better than the logical progression of an edited
script . My short answer is : there's no comparison . Forth
is bad enough where you can try things out interactively , but must
transfer them to a script to make permanent .
Perhaps the defining attribute of CoSy
since its origins has been the ability to execute lines of APL
at the tap of a function key while otherwise being a simple
text editor . Unlike a lot of traditional APL
session managers
, it doesn't otherwise mess with your notes .
Over
the years , I've evolved an SOP for working thru problems , like the
construction list for the Conic
All Connect so I could draw it , or understanding of the
most basic
physics of planetary temperature
. : Each time I get back to a problem , I copy forward to the
day's notes those lines in my previous work which are actually
essential to the flow of the solution . Thus I end up with a concise
script which often I never consolidate into a function ; it's just
simpler and more flexible to execute them interactively line by line
whenever I need repeat the task . Here's a recent example :
We needed to create a new
checking account to cover construction and
ongoing costs for a rather exceptional horse property we purchased for
the family trust in urban Denver . Below are my annotated
notes
in the Job text `.CoSy.AF.MEJA.y2011.text
working thru the conversion of the download of the bank's
account history to a K
dictionary table to be integrated into the entire hyperlinked set of
family
accounts .
Jump to the
last day and work
backwards thru the work that got winnowed down to that final script .
I
first tried using the bank's .csv file , which is
trivial to convert ( since I have a word csvcut
already to do the essential conversion ) . But , their .csv
file didn't contain all the information in their Quicken
format .
It turned out .qfx files are the same as .ofx
files I deal with on other accounts with a Quicken
proprietary header prepended . So , after lopping off the header , I
just reworked a script copied from one of those accounts .
In K.CoSy , there are two
function keys which execute lines . F6
executes in the current dictionary , eg , `.CoSy.AF.MEJA.y2011 ,
F7 in the root dictionary .R
: `.CoSy where all the functions
are stored . You'll find a few lines executed in the root to avoid
having to reference thru .R
.
The resulting ledger , a K dictionary
table , or database , ie , a K
dictionary with all items equal length lists ,
is shown below the script -- as is the final script
in `.CoSy.AF.MEJA.y2011.state
for appending updates to the account .
Development notes
/
###################################################################### /
`.CoSy.AF.MEJA
`.CoSy.AF.MEJA.y2010
/ ============================= /
LOG / ============================ /
/ ======================== / fri.jan.20110107 /
======================== /
/ ...
/ ======================== / mon.feb.20110207 /
======================== /
Setting up Wells fargo Bear Creek Acnt
.r : 0: "C:/CoSy/AF/MEJA/y2011/WF_BearCreek.csv"
/ ======================== / mon.feb.20110207 /
======================== /
: Q : ( .R `csvcut )' -2 _ .r
+ Q
.r : 0: "C:/CoSy/AF/MEJA/y2011/WF_BearCreek.qfx"
: Q : toksplt[ "<" ] @ ,/ .r
Q : r
: QW : ( .R `VMn )' 2 _ ( .R `htmlsplt )[ "STMTTRN"
] ( .R `MVn ) Q
: QW : + { -1 _ 1 _ x }' ( .R `pad ) QW
`QW
...
/ ======================== / wed.feb.20110209 /
======================== /
sort @ _ic ? ,// D `QW
: Q : ( .R `DRB )'' _ssr[ ; _ci , 9 ; " " ]'' QW
Q 0
/ ======================== / wed.feb.20110216 /
======================== /
.r : 0: "C:/CoSy/AF/MEJA/y2011/WF_BearCreek.csv"
/ ======================== / thu.feb.20110217 /
======================== /
: QW : + -2 _ ( .R `csvcut )' .r
`QW
@[ D `QW ; 1 ; { evaln clnnums x }' ]
QW : r
@[ D `QW ; 0 ; { . clnnums ymd_mdy x }' ]
WF_BearCreek[ `date `description `ref `amount ] : QW 0 4 3 1
( .R `setDTattr ) `WF_BearCreek
( .R `setDTbal )[ `WF_BearCreek ; `bal ; `amount ]
: Q : `type `taxType `who `account ,' ( ` ; ` ; , "" ; , "" )
`WF_BearCreek ( .R `DTaddCol )/ Q
( .R `DTaddCol )[ WF_BearCreek ; `account ; , "" ]
WF_BearCreek.description
/ ======================== / thu.feb.20110224 /
======================== /
.r : 0: "C:/CoSy/AF/MEJA/y2011/WF_BearCreek.qfx"
: Q : * 1 _ ( .R `htmlsplt )[ "OFX" ] @ ( .R `MVn ) .r
: QW : 2 _ ( .R `htmlsplt )[ "STMTTRN" ] Q
: QW : ( -1 _' 1 _' ( .R `VMn )' QW ) _dv'' "\t"
&/ { x ~ ? x }' QWE : 1 _'' ( .R `PRTBF )[ ;
">" ]'' QW />/ 1
QWE : { x : ( .R `SPLTF )[ ; ">" ] x ; x[ 0 ] : ` $1 _
x 0 ; x }'' QW
QWE : { x : ( .R `SPLTF )[ ; ">" ] x ; ( ` $1 _ x 0 ;
, 1 _ x 1 ) }'' QW
: QWER : ( .R `mkDT ) @ ? ,/ QWE[ ; ; 0 ]
.R `mkDT
QWER : { x : . x ,\: , () ; x } @ ? ,/ QWE[ ; ; 0 ]
QWER ( .R `DTjoin )[ ; ; ! QWER ]/ .:' QWE
.r : "<" ,' 1 _ ( .R `VM )[ "<" ] Q
( ( .R `PRTBF )[ ; ">" ]' .r ) ,' ">"
( .R `CON )[ .r ; "sever" ]
/ ======================== / fri.feb.20110225 /
======================== /
.r : 0: "C:/CoSy/AF/MEJA/y2011/WF_BearCreek.qfx"
: Q : * 1 _ ( .R `htmlsplt )[ "OFX" ] @ ( .R `MVn ) .r
: QW : 2 _ ( .R `htmlsplt )[ "STMTTRN" ] Q
: QW : ( -1 _' 1 _' ( .R `VMn )' QW ) _dv'' "\t"
QWE : { x : ( .R `SPLTF )[ ; ">" ] x ; ( ` $1 _ x 0 ;
, 1 _ x 1 ) }'' QW
.R `mkDT />/ { x : . x ,\: , , _n ; x }
mkDT : { x : . x ,\:
, () ; x
}
/ F7
mkDT..h : " make new
empty DictionaryTable with names x
"
/ F7
: QWER : ( .R `mkDT ) @ ? ,/ QWE[ ; ; 0 ]
{ : x : { x : SPLTF[ ; ">" ] x ; ( ` $1 _ x 0 ; , 1 _
x 1 ) }'' x ; } D `QW
.r : { t : mkDT @ ? ,/ x[ ; ; 0 ] ; t DTjoin[ ; ; !
t ]/ .:' x } D `r
+ $ .r `NAME `MEMO
.r.MEMO..l : 100 # "/
MEMO /"
.r.NAME..l : 30 # " NAME "
/ ( .R `venn ) .' + $ .r `NAME
`MEMO / not useful
{ ( #:' x[ 0 ] ) #' x 1 } .r `NAME `MEMO
_n ~'' .r `NAME `MEMO
.r[ ] $:
{ x[ 0 ] ~' ( #:' x[ 0 ] ) #' x 1 } .r `NAME `MEMO
/ ======================== / mon.feb.20110228 /
======================== /
: Q : { x[ 0 ] ~' ( #:' x[ 0 ] ) #' x 1 } .r `NAME
`MEMO
.r[ `NAME `MEMO ; & ~ Q
] / checking that all non-matches are empty
.r.MEMO : { ( #:' x[ 0 ] ) _' x 1 } .r `NAME `MEMO
: Q : "CHECK" ~/: .r `NAME
.r.NAME[ & Q ] : "CHECK " ,/: .r.CHECKNUM[ &
Q ]
: WF_BearCreek : .()
! Schwab />/ `date `description `amount `bal `type
`taxType `who `symbol `action `price `quantity `feescomm `account
: WF_BearCreek[ `date `description `amount ] : ( (
. -1 _ )' .r `FITID ; .r `NAME ; .:' .r `TRNAMT )
( .R `setDTbal )[ `WF_BearCreek ; `bal ; `amount ]
.CoSy.AF.MEJA.y2011.WF_BearCreek `amount
/ ======================== / wed.mar.20110302 /
======================== /
.r : 0: "C:/CoSy/AF/MEJA/y2011/WF_BearCreek.qfx"
: Q : * 1 _ ( .R `htmlsplt )[ "OFX" ] @ ( .R `MVn ) .r
/ I already had several of the lines below because I have several OFX
inputs .
: QW : 2 _ ( .R `htmlsplt )[ "STMTTRN" ] Q
: QW : ( -1 _' 1 _' ( .R `VMn )' QW ) _dv'' "\t"
/ \/
convert \/
F7 /
{ : x : { x : SPLTF[ ; ">" ] x ; ( ` $1 _ x 0 ; , 1 _
x 1 ) }'' x ; } D `QW
.r : { t : mkDT @ ? ,/ x[ ; ; 0 ] ; t DTjoin[ ; ; !
t ]/ .:' x } D `r
/ /\
convert /\
F7 /
.r.MEMO : { ( #:' x[ 0 ] ) _' x 1 } .r `NAME `MEMO
: Q : "CHECK" ~/: .r `NAME
.r.NAME[ & Q ] : "CHECK " ,/: .r.CHECKNUM[ &
Q ]
: WF_BearCreek : .()
: WF_BearCreek[ `date `description `amount ] : ( (
. -1 _ )' .r `FITID ; .r `NAME ; .:' .r `TRNAMT )
( .R `setDTbal )[ `WF_BearCreek ; `bal ; `amount ]
/ ======================== / thu.mar.20110303 /
======================== /
( .R `DTaddCol )[ `WF_BearCreek ; `account ; ` ]
WF_BearCreek[ `memo ] : .r.MEMO
`WF_BearCreek . " who : description "
: Q : WF_BearCreek.who ~\: "POS PURCHASE
-
"
WF_BearCreek.who[ & Q ] : WF_BearCreek.memo[
& Q ]
Output as
"C:/CoSy/AF/MEJA/y2011/WF_BearCreek.CSV" 0: ( .R `DT2csv )[
";" ] WF_BearCreek
"C:/CoSy/AF/MEJA/y2011/WF_BearCreek.HTML" 0: ( .R `DT2html )
WF_BearCreek
( .R `setDTattr ) .
`WF_BearCreek
/ F9 / displays object in own
window
+/ .CoSy.AF.MEJA.y2011.WF_BearCreek `amount
/ calculate balance .
/
====================================================================== /
R
.R
/
###################################################################### /
`.CoSy.AF.MEJA.y2010
/
###################################################################### / |
The resulting ledger :
The final script for updating the account .
If you are interested in this sort of stuff , make sure you're on the
mailing list .
--
Bob Armstrong
--
|
|
I
reserve the right to post all communications I receive or generate to
CoSy website for further reflection .
Coherent Systems / 28124 N Hwy 67 / Woodland Park , CO 80863 |
|