TXT: Collaborative text

txt is a plaintext mapper for the rga RDT. It converts RGA arrays to human-readable text, assuming the RGA contains chars (not numbers or strings or UUIDs).

Here is an example conversation with the txt mapper:

  1 @~ 'create a CT' !
  2 @1l54hK+test :rga, 'w', 'o', 'r', 'l', 'd' ;
  3 
  4 @~ 'read the text' !
  5 @1l54hK-test :txt?
  6 
  7 @~ 'text is OK'?
  8 @1l54hK-test :txt 'world' ;
  9 
 10 @~ 'write the state' !
 11 @1l54hK-test :txt 'Helo world.' !
 12 @0 :tag AT~HELO !
 13 @1l54hK-test :txt ?
 14 
 15 @~ 'check the state' ?
 16 @1l54hK-test :txt 'Helo world.';
 17 
 18 @~ 'a patch' !
 19 @1l54hK-test :txt patch,
 20     3 'l' 9 -1 10 '!' !
 21 
 22 @~ 'query the patched text'!
 23 @1l54hK-test :txt ?
 24 
 25 @~ 'is it patched OK?' ?
 26 @1l54hK-test :txt 'Hello world!';
 27 
 28 @~ 'query the old version'!
 29 @1l54hK-test :txt at AT~HELO ?
 30 
 31 @~ 'is the old version recovered?' ?
 32 @1l54hK-test :txt at AT~HELO,
 33     'Helo world.';
 34 
 35 @~ 'query a diff'!
 36 @1l54hK-test :txt since AT~HELO ?
 37 
 38 @~ 'check the diff'?
 39 @1l54hK-test :txt since AT~HELO,
 40     3 'l' 9 -1 10 '!' ;
 41 
 42 @~ 'query a hili'!
 43 @1l54hK-test :txt hili AT~HELO ?
 44 
 45 @~ 'check the hili'?
 46 @1l54hK-test :txt hili AT~HELO,
 47     eq 'Hel' in 'l' eq 'o world' in '!' rm '.';
 48 

Sets.