|
|
1.1 root 1: .TL \" Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984.
2: A User's Guide to the B system
3: .AU
4: Steven Pemberton
5: CWI, Amsterdam
6: .ds B \fIB\fP
7: .so bfont.def
8: .AB
9: \*B is a new interactive programming language being developed at the CWI.
10: This report gives a brief introduction to using the current \*B implementation.
11: It does not teach you about the language, for which you should refer elsewhere.
12: .AE
13: .SH
14: .bp
15: Introduction
16: .PP
17: .de BX
18: 'nh
19: \v'-\\n(.su/2u'\(br\v'\\n(.su/2u'\|\\$1\|\v'-\\n(.su/2u'\(br\v'\\n(.su/2u'\\h'-\\w'|'u/2u'\l'|0+(\\w'|'u/2u)\(rn'\\h'-\\w'|'u/2u'\l'|0\(ul'\\$2
20: 'hy
21: ..
22: .de BR
23: [\\$1]\\$2
24: ..
25: .de KY
26: .ie t .BX \\$1 \\$2
27: .el .BR \\$1 \\$2
28: ..
29: This guide is a brief introduction to using the current \*B system.
30: It does not attempt to teach you about the language,
31: for which you should refer elsewhere.
32: .PP
33: Furthermore, certain details such as how to start the system up,
34: and which keys on your terminal correspond to the keys mentioned,
35: depend on your local installation, and are not mentioned in this guide.
36: Keys are just referred to here by their name, such as
37: .KY accept .
38: Refer to the ``bterminal(5)'' manual entry for these details.
39: .PP
40: Some older \*B systems don't let you make changes to immediate commands,
41: nor give you suggestions to immediate commands, but only in units.
42: .SH
43: Starting up
44: .PP
45: The first response you should get from the \*B system when you start it up
46: is a prompt that looks like this:
47: .DS
48: \*(<:>>> _?\*(:>
49: .DE
50: The underlined question mark is the indication from the \*B system
51: that it is expecting input from you.
52: (In fact, it depends on the sort of terminal you have
53: whether it is underlined, displayed in reverse video, or what.
54: In any case it is displayed in some special way,
55: and we shall use underlining in this guide.)
56: When it follows the three arrows \*(<:>>>\*(:>, called the \fIcommand prompt\fP,
57: it is expecting you to type in a command.
58: The question mark is called a \fIhole\fP
59: and indicates that something should be filled in;
60: the underline is called the \fIfocus\fP
61: and shows where you are currently working.
62: .PP
63: You can fill this hole by typing in a \*(<:WRITE\*(:> command for instance:
64: you type a \*(<:W\*(:>
65: (which you don't have to type in upper-case:
66: the system knows that it may only be upper-case here),
67: and you immediately see:
68: .DS
69: \*(<:>>> W_?RITE ?\*(:>
70: .DE
71: This extra stuff to the right of the focus is a \fIsuggestion\fP.
72: Most times that you type a \*(<:W\*(:> as the first letter of a command,
73: it is because you want a \*(<:WRITE\*(:>.
74: Therefore the editor suggests this,
75: with an additional hole for the expression that you want to write.
76: If you do want a \*(<:WRITE\*(:>
77: (as in this case)
78: you may press the
79: .KY accept
80: key to accept the suggestion \(em the editor
81: then moves to the first unfilled hole in the command,
82: which in this case is the only one,
83: and you get:
84: .DS
85: \*(<:>>> WRITE _?\*(:>
86: .DE
87: You can now type an expression and press the
88: .KY newline
89: key.
90: The system evaluates the expression,
91: prints the result,
92: and then gives you a new command prompt.
93: Here are a few examples of \*(<:WRITE\*(:> commands:
94: .DS
95: \*(<:>>> WRITE 2+2
96: 4
97: >>> WRITE root 2
98: 1.414213562373095
99: >>> WRITE pi
100: 3.141592653589793\*(:>
101: .DE
102: If you make a mistake while typing and spot it before you type
103: .KY newline ,
104: an easy way to correct it is to use the
105: .KY back
106: key.
107: Pressing
108: .KY back
109: takes you back to the situation before you typed
110: the last key (\fIexactly\fP the situation,
111: as you will see clearly after a little use).
112: If you type
113: .KY back
114: twice,
115: you will be taken back to the situation as it was two keys ago,
116: and so forth.
117: You can regard the
118: .KY back
119: key as a way of travelling back in time.
120: .LP
121: Thus, if you meant to type \*(<:WRITE pi\*(:>,
122: but instead typed \*(<:WRITE po\*(:>,
123: you will see this:
124: .DS
125: \*(<:>>> WRITE po_?\*(:>
126: .DE
127: Now pressing
128: .KY back
129: will give you
130: .DS
131: \*(<:>>> WRITE p_?\*(:>
132: .DE
133: Now you can type the \*(<:i\*(:> and the
134: .KY newline .
135: Currently you can only go back a maximum of 100 keystrokes,
136: and in any case only as far as the command prompt
137: (and thus not back to previous commands).
138: You will see other ways to correct mistakes shortly.
139: .PP
140: If you make a mistake so that the result is illegal \*B,
141: but don't notice before you press
142: .KY newline
143: you will get an error message:
144: .DS
145: \*(<:>>> WRITE root 3**2+4**2
146: *** There's something I don't understand in your command
147: WRITE root 3**2+4**2
148: ^
149: *** The problem is: priorities? use ( and ) to resolve\*(:>
150: .DE
151: The problem here is that the system doesn't know
152: if you want to apply \*(<:root\*(:> to \*(<:3\*(:> or \*(<:3**2\*(:> or \*(<:3**2+4**2\*(:>
153: and you should use brackets to show which.
154: .PP
155: When you type an open bracket,
156: the system automatically supplies the matching closing bracket for you:
157: .DS
158: \*(<:>>> WRITE root(_?)\*(:>
159: .DE
160: You now type in the expression
161: .DS
162: \*(<:>>> WRITE root(3**2+4**2_?)\*(:>
163: .DE
164: You may now type
165: .KY newline
166: \^(
167: .KY accept
168: will take you over the closing bracket,
169: but it is not necessary to do this):
170: .DS
171: \*(<:>>> WRITE root(3**2+4**2)
172: 5\*(:>
173: .DE
174: .LP
175: You can write any legal \*B value:
176: .DS
177: \*(<:>>> WRITE {1..10}
178: {1; 2; 3; 4; 5; 6; 7; 8; 9; 10}
179: >>> WRITE 'Hello! '^^3
180: Hello! Hello! Hello!\*(:>
181: .DE
182: Just as with brackets,
183: the system automatically supplies the closing brace \*(<:}\*(:>,
184: and the closing quote \*(<:'\*(:>.
185: In the latter case,
186: where you want to type something after the closing quote
187: you may either use
188: .KY accept
189: or type the quote yourself,
190: in order to position after it.
191: .PP
192: Commands typed as a response to the command prompt
193: are called `immediate' commands,
194: since they are executed immediately.
195: Another example is the \*(<:PUT\*(:> command.
196: Just as with \*(<:WRITE\*(:>,
197: when you type the first letter of the command,
198: the system provides a suggestion:
199: .DS
200: \*(<:>>> P_?UT ? IN ?\*(:>
201: .DE
202: Again,
203: you use
204: .KY accept
205: to go to the first hole:
206: .DS
207: \*(<:>>> PUT _? IN ?\*(:>
208: .DE
209: Here you type an expression,
210: .DS
211: \*(<:>>> PUT root 2?_ IN ?\*(:>
212: .DE
213: followed by another
214: .KY accept
215: to take you to the second hole:
216: .DS
217: \*(<:>>> PUT root 2 IN _?\*(:>
218: .DE
219: where you can type a target,
220: followed by
221: .KY newline :
222: .DS
223: \*(<:>>> PUT root 2 IN a
224: >>> PUT root 3 IN b
225: >>> WRITE a
226: 1.414213562373095
227: >>> WRITE b
228: 1.732050807568877
229: >>> WRITE a,b
230: 1.414213562373095 1.732050807568877
231: >>> WRITE a*a, b*b
232: 2 3\*(:>
233: .DE
234: The targets that you create in this way,
235: through immediate commands,
236: are called `permanent targets',
237: because if you stop using the system,
238: and log out,
239: and come back later and start using the system again
240: you will find that the targets are still there,
241: with the same values as before.
242: .PP
243: You can find out which targets exist
244: by typing two equals signs after the prompt:
245: .DS
246: \*(<:>>> ==
247: a b
248: >>> PUT 'hello', {1..10} IN message, list
249: >>> ==
250: a b list message
251: >>> WRITE list
252: {1; 2; 3; 4; 5; 6; 7; 8; 9; 10}
253: >>> WRITE message
254: hello\*(:>
255: .DE
256: To get rid of targets you no longer want, use the \*(<:DELETE\*(:> command:
257: .DS
258: \*(<:>>> DELETE a, b
259: >>> ==
260: list message
261: >>> WRITE a
262: *** Can't cope with problem in your command
263: WRITE a
264: *** The problem is: a has not yet received a value\*(:>
265: .DE
266: As you can see,
267: after the \*(<:DELETE\*(:> command both \*(<:a\*(:> and \*(<:b\*(:> have ceased to exist.
268: .SH
269: Other Immediate Commands
270: .PP
271: In fact,
272: almost any \*B command can be used as an immediate command;
273: the only exceptions are the commands used to terminate \*(<:TEST\*(:>s and \*(<:YIELD\*(:>s,
274: namely \*(<:RETURN\*(:>, \*(<:REPORT\*(:>, \*(<:SUCCEED\*(:> and \*(<:FAIL\*(:>.
275: .DS
276: \*(<:>>> WRITE list
277: {1; 2; 3; 4; 5; 6; 7; 8; 9; 10}
278: >>> INSERT 5 IN list
279: >>> REMOVE 6 FROM list
280: >>> WRITE list
281: {1; 2; 3; 4; 5; 5; 7; 8; 9; 10}
282: >>> CHOOSE number FROM list
283: >>> WRITE number
284: 9
285: >>> CHECK 5 in list
286: >>> CHECK 6 in list
287: *** Your check failed in your command
288: CHECK 6 in list
289: >>> FOR i IN list: WRITE 10*i
290: 10 20 30 40 50 50 70 80 90 100
291: >>> ==
292: list message number\*(:>
293: .DE
294: Note that a \*(<:CHECK\*(:> command that succeeds doesn't print any message.
295: Also note carefully that
296: the target \*(<:i\*(:> used in the \*(<:FOR\*(:> command doesn't exist afterwards.
297: .PP
298: When you want to type a \*(<:WHILE\*(:> command,
299: and you type the initial \*(<:W\*(:>,
300: the suggestion you get is of course \*(<:W_?RITE ?\*(:>.
301: Here you must type an \*(<:H\*(:>,
302: and the system then suggests
303: .DS
304: \*(<:>>> WH_?ILE ?:\*(:>
305: .DE
306: Now you can press
307: .KY accept
308: to go to the hole,
309: type the test,
310: and press
311: .KY newline :
312: .DS
313: \*(<:>>> WHILE list <> {}:
314: _?\*(:>
315: .DE
316: Because the \*B system knows that the commands of a \*(<:WHILE\*(:> must be indented,
317: it indents for you automatically.
318: You may now type in the commands to be part of the \*(<:WHILE\*(:>,
319: and each time the system indents you to the right place.
320: After the last command you just need to type an extra
321: .KY newline ,
322: and the system undoes the indentation one level,
323: and executes the \*(<:WHILE\*(:>.
324: (If there is only one simple command to be repeated,
325: it may be on the same line as the \*(<:WHILE\*(:>,
326: but doesn't have to be).
327: .DS
328: \*(<:>>> WHILE list <> {}:
329: CHOOSE number FROM list
330: REMOVE number FROM list
331: WRITE number
332: 2 8 4 7 9 5 3 1 5 10
333: >>> WRITE list
334: {}\*(:>
335: .DE
336: .SH
337: Finishing a B Session
338: .PP
339: The one command that has a different meaning when you type it after a prompt
340: is \*(<:QUIT\*(:>,
341: which just terminates the \*B session.
342: When you type the \*(<:Q\*(:> you will get a suggestion as usual.
343: .DS
344: \*(<:>>> Q_?UIT\*(:>
345: .DE
346: Here there are no holes,
347: but you must still press
348: .KY accept
349: to accept the suggestion,
350: before pressing
351: .KY newline .
352: .SH
353: Making your own Commands
354: .PP
355: You can create your own commands by typing in a how-to unit
356: that defines what your command means.
357: Suppose you type in response to the \*B prompt:
358: .DS
359: \*(<:>>> HOW'TO GREET:
360: WRITE 'Hello'\*(:>
361: .DE
362: The system gives a suggestion for \*(<:HOW'TO\*(:>,
363: and supplies indentation for you,
364: just as with \*(<:WHILE\*(:>,
365: and you finish by pressing
366: .KY newline
367: until you get the command prompt again.
368: Well,
369: now you've defined your first command,
370: and can execute it by typing its name after the prompt.
371: You will notice that after typing the \*(<:G\*(:> you will get a suggestion for it:
372: .DS
373: \*(<:>>> G_?REET\*(:>
374: .DE
375: Just as with \*(<:QUIT\*(:>,
376: there are no holes,
377: but you must
378: .KY accept
379: the suggestion.
380: .DS
381: \*(<:>>> GREET_?\*(:>
382: .DE
383: Now press
384: .KY newline
385: and your command gets executed,
386: and you get the prompt again:
387: .DS
388: \*(<:>>> GREET
389: Hello
390: >>>\*(:>
391: .DE
392: You may use your own commands just like any in-built command:
393: .DS
394: \*(<:>>> FOR i IN {1..10}: GREET
395: HelloHelloHelloHelloHelloHelloHelloHelloHelloHello\*(:>
396: .DE
397: .SH
398: Correcting errors
399: .PP
400: Apart from
401: .KY back ,
402: another way of correcting errors is to correct a whole line.
403: Here you use the ability to move the focus about.
404: Earlier the focus was a single character,
405: just the hole.
406: However,
407: the focus may be more than one character: it may be several characters,
408: a whole command,
409: or even several commands.
410: .PP
411: Two of the eight keys for moving the focus are
412: .KY up
413: and
414: .KY down .
415: .PP
416: The
417: .KY up
418: key moves the focus up to the previous line
419: so that it includes the whole line.
420: So if you have the following situation:
421: .DS
422: \*(<:>>> FOR i IN {1..3}:
423: WRITE /
424: GREET
425: WRITE /_?\*(:>
426: .DE
427: then typing
428: .KY up
429: gives you
430: .DS
431: \*(<:>>> FOR i IN {1..3}:
432: WRITE /
433: GREET_____
434: WRITE /\*(:>
435: .DE
436: Here the hole in the last line has disappeared
437: (because the line is legal \*B)
438: and the focus has moved up to the whole of the preceding line.
439: You may press
440: .KY up
441: several time to go up several lines.
442: So,
443: pressing
444: .KY up
445: again gives:
446: .DS
447: \*(<:>>> FOR i IN {1..3}:
448: WRITE /_______
449: GREET
450: WRITE /\*(:>
451: .DE
452: The
453: .KY down
454: key does the same but in the other direction.
455: .PP
456: Now the point of all this is,
457: that if you have a line in a command or unit that you want to change,
458: you can move the focus to it,
459: and press
460: .KY delete
461: to get rid of it.
462: This leaves a hole in its place so that you can type a replacement line:
463: .DS
464: \*(<:>>> FOR i IN {1..3}:
465: ?_
466: GREET
467: WRITE /\*(:>
468: .DE
469: If you don't want to replace the line,
470: but completely delete it,
471: then pressing
472: .KY delete
473: again deletes the hole too:
474: .DS
475: \*(<:>>> FOR i IN {1..3}:
476: GREET_____
477: WRITE /\*(:>
478: .DE
479: .SH
480: Changing Existing Units
481: .PP
482: Just as you can type two equals signs
483: to find out what permanent targets you have,
484: you can type two colons to
485: find out what units you have in the current workspace.
486: This gives you a list of the first line of each unit in the workspace:
487: .DS
488: \*(<:>>> ::
489: HOW'TO GREET:\*(:>
490: .DE
491: If you want to change any of these units,
492: you can type a colon followed by the name of the unit you want:
493: .DS
494: \*(<:>>> :GREET\*(:>
495: .DE
496: (If the unit you want to change is the last unit you typed in
497: or changed in this session,
498: or the last unit that you got an error message about,
499: then you don't even need to type its name:
500: the system remembers the name of the unit,
501: so all you need to do is type a single colon.)
502: .PP
503: What happens now is that the whole unit is displayed
504: (or as much as will fit on the screen if it is big)
505: with the focus on the line you were last at in the unit.
506: You can now use all the focus moving keys to position
507: to the lines you want to change,
508: and change them.
509: When you have finished,
510: you use the
511: .KY exit
512: key.
513: .SH
514: Errors in Units
515: .PP
516: If when you type in or change a unit,
517: the result has an error in it,
518: you will get an error message from the \*B system.
519: This may happen when you press
520: .KY exit ,
521: or when you run the unit, depending on the sort of error it is.
522: For instance,
523: in this unit,
524: the parameter is \*(<:x\*(:>,
525: but \*(<:n\*(:> is used instead:
526: .DS
527: \*(<:>>> HOW'TO SQUARE x:
528: WRITE n*n
529: >>> SQUARE 4
530: *** Can't cope with problem in line 2 of your unit SQUARE
531: WRITE n*n
532: *** The problem is: n has not yet received a value\*(:>
533: .DE
534: When you get such a message,
535: it is very easy to make the necessary correction:
536: since the unit you want to change is
537: the last one that you got an error message for,
538: you only need to type a colon after the prompt:
539: .DS
540: \*(<:>>> :
541: HOW'TO SQUARE x:
542: WRITE n*n_________\*(:>
543: .DE
544: As you see,
545: you are positioned at the line that gave the error message.
546: Now you can either press
547: .KY delete
548: and retype the whole line,
549: or use the other focus-moving keys to focus on only the part that is in error.
550: .SH
551: Other Focus Moving Keys
552: .PP
553: Apart from
554: .KY up
555: and
556: .KY down
557: there are six other keys for moving the focus,
558: two for making the focus smaller:
559: .KY first
560: and
561: .KY last ,
562: two for enlarging it:
563: .KY widen
564: and
565: .KY extend ,
566: and two for moving it sideways:
567: .KY previous
568: and
569: .KY next .
570: .PP
571: In this case we want to make the focus smaller,
572: by going to the last part of the line.
573: Thus,
574: we can press
575: .KY last
576: and we see:
577: .DS
578: \*(<:HOW'TO SQUARE x:
579: WRITE n*n___\*(:>
580: .DE
581: Pressing
582: .KY delete
583: deletes the part in the focus,
584: leaving only a hole:
585: .DS
586: \*(<:HOW'TO SQUARE x:
587: WRITE ?_\*(:>
588: .DE
589: Now we can type the correct expression and then press
590: .KY exit :
591: .DS
592: \*(<:HOW'TO SQUARE x:
593: WRITE x*x\*(:>
594: .DE
595: Suppose now you have the following unit to solve quadratic equations
596: (if you don't know what these are,
597: it doesn't matter):
598: .DS
599: \*(<:HOW'TO SOLVE a X2 b X c:
600: PUT root (b**2-4*a*c) IN x
601: WRITE (-b+x)/2*a, (-b-x)/2*a /
602:
603: *** There's something I don't understand in line 3 of your unit SOLVE
604: WRITE (-b+x)/2*a, (-b-x)/2*a /
605: ^
606: *** The problem is: priorities? use ( and ) to resolve\*(:>
607: .DE
608: The system doesn't know whether to divide by \*(<:2\*(:> or \*(<:2*a\*(:>,
609: so you must insert brackets.
610: .DS
611: \*(<:>>> :
612: HOW'TO SOLVE a X2 b X c:
613: PUT root (b**2-4*a*c) IN x
614: WRITE (-b+x)/2*a, (-b-x)/2*a /______________________________\*(:>
615: .DE
616: Now we want to narrow down to \*(<:2*a\*(:>.
617: Pressing
618: .KY last
619: gives
620: .DS
621: \*(<:HOW'TO SOLVE a X2 b X c:
622: PUT root (b**2-4*a*c) IN x
623: WRITE (-b+x)/2*a, (-b-x)/2*a /________________________\*(:>
624: .DE
625: and then
626: .KY first
627: gives
628: .DS
629: \*(<:HOW'TO SOLVE a X2 b X c:
630: PUT root (b**2-4*a*c) IN x
631: WRITE (-b+x)/2*a, (-b-x)/2*a /___________\*(:>
632: .DE
633: and another
634: .KY first
635: gives
636: .DS
637: \*(<:HOW'TO SOLVE a X2 b X c:
638: PUT root (b**2-4*a*c) IN x
639: WRITE (-b+x)/2*a, (-b-x)/2*a /__________\*(:>
640: .DE
641: Now
642: .KY last
643: gives us
644: .DS
645: \*(<:HOW'TO SOLVE a X2 b X c:
646: PUT root (b**2-4*a*c) IN x
647: WRITE (-b+x)/2*a_, (-b-x)/2*a /\*(:>
648: .DE
649: The key
650: .KY extend
651: tries whenever possible to extend the focus to the right.
652: But it sometimes can't,
653: if what is to the right isn't associated with what is in the focus.
654: This is the case here:
655: the comma is associated with the \fIwhole\fP expression \*(<:(-b+x)/2*a\*(:>,
656: and so
657: .KY extend
658: extends to the left instead:
659: .DS
660: \*(<:HOW'TO SOLVE a X2 b X c:
661: PUT root (b**2-4*a*c) IN x
662: WRITE (-b+x)/2*a__, (-b-x)/2*a /\*(:>
663: .DE
664: and once more pressing
665: .KY extend :
666: .DS
667: \*(<:HOW'TO SOLVE a X2 b X c:
668: PUT root (b**2-4*a*c) IN x
669: WRITE (-b+x)/2*a___, (-b-x)/2*a /\*(:>
670: .DE
671: Now we have the expression we want,
672: and typing an opening bracket encloses the whole expression:
673: .DS
674: \*(<:HOW'TO SOLVE a X2 b X c:
675: PUT root (b**2-4*a*c) IN x
676: WRITE (-b+x)/(?_2*a), (-b-x)/2*a /\*(:>
677: .DE
678: Now you can use the focus moves to do the same to the second \*(<:2*a\*(:>.
679: .LP
680: The focus move keys are very easy to use.
681: After a little practice you will find they come very naturally.
682: .SH
683: Copying
684: .PP
685: It is often the case that you want to duplicate a piece of program.
686: If the focus is on something other than a hole,
687: the
688: .KY copy
689: key copies whatever is in the focus to what is called the
690: .I "copy buffer"
691: and lets you know that there is something in the copy buffer
692: by displaying the words \*(<:[copy\ buffer]\*(:> at the bottom of the screen,
693: along with the first bit of what is stored.
694: .PP
695: If, however, the focus is on a hole,
696: then the
697: .KY copy
698: key copies the contents of the buffer into that hole.
699: The \*(<:[copy\ buffer]\*(:> message then disappears, though
700: actually the contents of the buffer remain, so you can continue to use it.
701: However,
702: if the contents of the buffer may not be copied there, you just get a bleep;
703: for instance you can't copy a \*(<:WRITE\*(:> command to a place where
704: an expression must be.
705: .PP
706: You can use the
707: .KY copy
708: key for moving things too:
709: focus on what you want, press
710: .KY copy ,
711: press
712: .KY delete
713: twice to delete it and
714: the hole that gets left after the first delete,
715: move to where you want,
716: make a hole, and press
717: .KY copy
718: again.
719: .PP
720: Making a hole is straightforward.
721: A
722: .KY newline
723: always makes a hole on a new blank line
724: after the line that the focus was positioned on.
725: An
726: .KY accept
727: always takes you to the first hole on a line,
728: or if there is no hole on the line, then it makes one at the end of the line.
729: Finally, pressing
730: .KY first
731: or
732: .KY last
733: enough times makes one,
734: .KY first
735: in front of the focus,
736: .KY last
737: after it.
738: .PP
739: You can use the
740: .KY copy
741: key for copying between different units too.
742: Even if you log out, and come back later, and start using \*B again,
743: the copy buffer is kept.
744: .PP
745: Additionally, if the \*(<:[copy buffer]\*(:> message isn't being displayed,
746: that is, if the copy buffer is empty,
747: and you
748: .KY delete
749: something, whatever you delete is put into the copy buffer;
750: similarly if the copy buffer is empty,
751: each immediate command is stored in the copy buffer.
752: Thus if you mis-type an immediate command,
753: you can use
754: .KY copy
755: to bring it back, and edit it.
756: .SH
757: Renaming and deleting units
758: .PP
759: If you change the name of a unit, or the adicity of a \*(<:YIELD\*(:> or \*(<:TEST\*(:>
760: (such as making a dyadic \*(<:YIELD\*(:> into a monadic one) by changing its heading,
761: then you get the new unit
762: .I and
763: the old one.
764: So, renaming \*(<:GREET\*(:> into \*(<:HELLO\*(:>, and then giving a \*(<:::\*(:> command
765: would give:
766: .DS
767: \*(<:>>> ::
768: HOW'TO GREET:
769: HOW'TO HELLO:
770: HOW'TO SOLVE a X2 b X c:
771: HOW'TO SQUARE x:\*(:>
772: .DE
773: If you delete the
774: .I whole
775: of a unit (by pressing
776: .KY widen
777: until the focus is on the whole unit,
778: and then pressing
779: .KY delete )
780: the unit disappears.
781: Thus deleting \*(<:GREET\*(:> will give you:
782: .DS
783: \*(<:>>> ::
784: HOW'TO HELLO:
785: HOW'TO SOLVE a X2 b X c:
786: HOW'TO SQUARE x:\*(:>
787: .DE
788: .SH
789: Changing targets
790: .PP
791: You may also use the editor for changing permanent targets.
792: Just as you use a single colon for editing units,
793: a single equals followed by the name of a target
794: will display the contents of the target,
795: and let you make changes in the usual way.
796: In fact, you may replace the contents by any
797: .I expression.
798: When you press
799: .KY exit ,
800: the expression is evaluated, and if all is ok
801: the value is put in the target.
802: .SH
803: Workspaces
804: .PP
805: A workspace is a collection of units plus a permanent environment.
806: You can have several workspaces: to create a new one
807: you just start \*B up in a new directory in the filestore.
808: .PP
809: To move units and targets between workspaces, just use the
810: .KY copy
811: key:
812: start \*B up in the one workspace, save whatever you want to move
813: in the copy buffer,
814: exit \*B, move to the destination workspace,
815: re-enter \*B, and copy the buffer back.
816: .SH
817: Record and play
818: .PP
819: Sometimes you need to repeat a sequence of keystrokes several times.
820: For instance, if you want to rename a target in a unit,
821: you have to do it once for each occurrence of the target.
822: An easy way to do this is to
823: .I record
824: a sequence of keystrokes.
825: If you press
826: .KY record ,
827: the message \*(<:[recording]\*(:> appears at the bottom of the screen,
828: and any keys that you type thereafter are processed normally
829: and recorded at the same time,
830: until you press
831: .KY record
832: again.
833: Then pressing
834: .KY play
835: plays those recorded keystrokes back.
836: .PP
837: So, for instance, focus on the target you want to rename,
838: press
839: .KY record ,
840: press
841: .KY delete ,
842: type the new name, and press
843: .KY record
844: again.
845: Then focus on the next occurrence of the target,
846: and press
847: .KY play .
848: .PP
849: Keystrokes that cause an error during recording are not recorded.
850: .SH
851: Redisplaying the screen
852: .PP
853: Sometimes the screen can get messed up
854: (for instance, if your terminal gets accidentally unplugged).
855: If this happens, or you don't believe what you see on the screen,
856: you can always get confirmation by pressing
857: .KY look .
858: This causes the screen to be redisplayed.
859: .SH
860: Interrupting a running command
861: .PP
862: If a command is executing, and you want to stop it,
863: pressing
864: .KY interrupt
865: aborts the command
866: and gives you a prompt again.
867: .SH
868: Incomplete units
869: .PP
870: If, when typing in or correcting a command or unit,
871: you press
872: .KY exit
873: and there are still unfilled holes,
874: the system tells you so,
875: and you must fill or delete them.
876: If you want to exit leaving the holes, to fill them later,
877: use the
878: .KY interrupt
879: key.
880: The system won't let you run an incomplete unit.
881: .SH
882: Getting help
883: .PP
884: Pressing the
885: .KY help
886: key gives you a quick summary of all the keys.
887: Refer to the ``Quick Reference'' card for a brief reminder of the features of
888: the \*B language,
889: and the ``Description of \*B'' for more detailed explanations.
890: .SH
891: Running \*B in the background
892: .PP
893: If your computer system lets you,
894: you can also run \*B non-interactively.
895: In this case \*B commands are read from the standard input, and executed.
896: You may only use normal \*B commands in this case: no focus moves,
897: or editing, and no \*(<:::\*(:> or \*(<:==\*(:> commands.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.