Differences From Artifact [5b11c669c7fe746c]:
File user/crc/patengi.retro part of check-in [87f9808c0a] - playground: change references to 2dup to 2over (all working apps updated) by charleschilders on 2011-02-13 16:33:41. [annotate] [view]
To Artifact [6624c3fd41f2b232]:
File user/crc/patengi.retro part of check-in [5a309ea759] - start updating crc's toys to work with retro 11 image by crc on 2011-03-14 20:17:26. [annotate] [view]
@@ -1,21 +1,20 @@
-chain: db::core
+chain: db::core'
( --- tools for dealing with lists --- )
- : deep ( an-a) 0; for @ next ;
+ : deep ( an-a) 0; &@ times ;
: deepest ( a-a ) repeat dup @ 0; nip again ;
: link, ( a- ) here 0 , swap deepest ! ;
: prop ( a"-a) @last swap !last ' swap !last ;
- : after ( a-a ) last repeat 2over @ =if nip ;then @ 0; again ;
( --- tables: fields/offsets, rows/links, etc. --- )
2 elements table row
: save ( "- ) @table constant ;
: load ( a- ) @dup !row !table ;
: link @table ; ( least recent row added )
- : size link 1+ ; ( number of fields )
- : head size 1+ ; ( header for last field )
+ : size link 1+ ; ( number of fields )
+ : head size 1+ ; ( header for last field )
: fields
- @last swap dup for ' create r , , next
+ @last swap dup [ ' create swap , , ] iter
here !table 0 , , @last , !last ;
: f:num @ ;
: f:xt f:num @row + @ ;
: f:fun 1+ @ ;
@@ -24,30 +23,30 @@
: name:f @head prop ;
: row, ( a- ) here !row link link, @size allot ;
: insert ( n"- ) name:f f:num @row + ! ;
: nwhere ( n- ) @link swap deep !row ;
- : 3dup dup push push 2dup pop -rot pop ;
+ : 3dup dup [ 2over &-rot dip ] dip ;
: match? ( ana- ) 3dup + @ compare ;
: where ( a"- ) name:f f:num @link
- repeat match? if !row drop ;then @ again ;
+ repeat match? [ !row drop 0 ] ifTrue 0; @ again ;
: select ( "- ) name:f f:xt ;
- : select-list ( n"- ) for name:f f:pair cr with-class next ;
- : select-all ( - ) @size for r num:f f:pair cr with-class next ;
+ : select-list ( n"- ) [ name:f f:pair cr withClass ] times ;
+ : select-all ( - ) @size [ num:f f:pair cr withClass ] iter ;
;chain
-with db::core
+with db::core'
-chain: db::io
+chain: db::io'
( --- output types --- )
- : chars for @+ emit next ;
- : string: .data ` type ; immediate
- : num: .data ` . ; immediate
+ : chars [ @+ putc ] times ;
+ : string: .data ` puts ; immediate
+ : num: .data ` putn ; immediate
( --- input methods --- )
- : keep: here repeat key dup '~ =if drop 0 , ;then dup emit , again ;
+ : keep: here repeat getc dup '~ = [ drop 0 , 0 ] ifTrue 0; dup putc , again ;
: number: here swap , ;
;chain
-with db::io
+with db::io'
( --- example table --- )
5 fields string: title string: author string: genre string: series num: year
save books