A snapshot of one discussion item. I don't know when this really occurred as DJW and I have been discussing this for years.. definitely since before 2000 (so the 20091020 date is probably 10 years after the "deed").
Note that the spacing on the lines is lost in this post... I'll see what I can do to remedy this... If not please "imagine" that the lines without a tag have a leading space.
--- ldl@anGus:/var/laptop/boGus.20091020/ldl/LittleM$ cat Mm.idea A simplification of 'M' to 'm' is the removal of the dotted do notation. So, are there any problems with the following? Any issues? Just wanting to make sure I'm not missing anything...
Illustrates multiple levels of dotted-do with localized goto targets, etc...
TAG ; s usage=$g(^DBK) g:'+usage skipd s vout="v.dat" o vout s uout="u.dat" o uout s gout="g.dat" o gout date s d="" f s d=$o(^DBK(d)) q:d="" d . s dt=$zd(d),dt=19_$p(dt,"/",3)_$p(dt,"/")_$p(dt,"/",2) . s usage=$g(^DBK(d)) . g:'+usage skipv vol . s v="" f s v=$o(^DBK(d,v)) q:v="" d . . s usage=$g(^DBK(d,v)) . . g:'+usage skipu . . u vout w dt_","_v,! uci . . s u="" f s u=$o(^DBK(d,v,u)) q:u="" d . . . s usage=$g(^DBK(d,v,u)) . . . g:'+usage skipg . . . u uout w dt_","_v_","_u_","_+usage,! gbl . . . s g="" f s g=$o(^DBK(d,u,v,g)) q:g="" d . . . . s usage=$g(^DBK(d,v,u,g)) . . . . u gout w dt_","_v_","_u_","_g_","_+usage,! skipg . . . u gout w "---",! skipu . . u uout w "---",! skipv . u vout w "---",! skipd c vout c uout c gout
Equivalent linear code, expect that &# are unique invented labels:
TAG ; s usage=$g(^DBK) g:'+usage skipd s vout="v.dat" o vout s uout="v.dat" o uout s gout="v.dat" o gout s d="" f s d=$o(^DBK(d)) q:d="" d &1 skipd c vout c uout c gout q &1 ; ----------------------------------------------------- s dt=$zd(d),dt=19_$p(dt,"/",3)_$p(dt,"/")_$p(dt,"/",2) s usage=$g(^DBK(d)) g:'+usage skipv vol s v="" f s v=$o(^DBK(d,v)) q:v="" d &2 skipv u vout w "---",! q &2 ; ----------------------------------------------------- s usage=$g(^DBK(d,v)) g:'+usage skipu u vout w dt_","_v,! uci s u="" f s u=$o(^DBK(d,v,u)) q:u="" d &3 skipu u uout w "---",! q &3 ; ----------------------------------------------------- s usage=$g(^DBK(d,v,u)) g:'+usage skipg u uout w dt_","_v_","_u_","_+usage,! gbl s g="" f s g=$o(^DBK(d,u,v,g)) q:g="" d &4 skipg u gout w "---",! q &4 ; ----------------------------------------------------- s usage=$g(^DBK(d,v,u,g)) u gout w dt_","_v_","_u_","_g_","_+usage,! q ; -----------------------------------------------------
Another semi-obtuse transformation... Whether the program does anything meaningful or not is not important, are the two equivalent?
s j=1 TAG d f i=0:0 d q:i d w i,j! inner . s j=j+1 s:j=40 i=j w "Done",! Maps to: s j=1 TAG d &1 f i=0:0 d &1 q:i d &1 w i,j! w "Done",! q &1 ; ----------------------------------------------------- inner s j=j+1 s:j=40 i=j q ; ----------------------------------------------------- ldl@anGus:/var/laptop/boGus.20091020/ldl/LittleM$
_________________ 3960 Schooner Loop 651-340-4007 Las Cruces, NM 88012-6067
|