Skip to content

Commit 649f7ae

Browse files
committed
Update tutorial
1 parent 27a73f7 commit 649f7ae

File tree

1 file changed

+183
-10
lines changed

1 file changed

+183
-10
lines changed

lib/node_modules/@stdlib/repl/docs/tutorials/read_eval_print_loop.txt

Lines changed: 183 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,29 @@
22

33
• At the command prompt, enter
44

5-
```javascript
6-
pres();
7-
```
5+
```javascript
6+
pres();
7+
```
88

9-
followed by \*RETURN\s to see the list of available commands.
9+
followed by \*RETURN\s to see the list of available commands.
1010

1111
• Enter
1212

13-
```javascript
14-
n();
15-
```
13+
```javascript
14+
n();
15+
```
16+
17+
followed by \*RETURN\s to advance the tutorial.
18+
19+
---
1620

17-
followed by \*RETURN\s to advance the tutorial.
21+
• To end the tutorial at any time, enter
22+
23+
```javascript
24+
presentationStop();
25+
```
26+
27+
followed by \*RETURN\s.
1828

1929
---
2030

@@ -89,11 +99,174 @@ the \*r\sead-\*e\sval-\*p\srint \*l\soop.
8999

90100
--
91101

92-
• interactivity
102+
• demos (including live coding)
103+
104+
--
105+
106+
• interactivity (such as during iterative development)
107+
108+
---
109+
110+
To get started using this REPL, a few commands will prove immensely useful.
111+
112+
---
113+
114+
The first command is
115+
116+
```javascript
117+
help()
118+
```
119+
120+
Run the above command to see a list of REPL commands.
121+
122+
---
123+
124+
To see the documentation for a specific REPL alias, provide the alias to the
125+
`help()` command.
126+
127+
For example, run
128+
129+
```javascript
130+
help( 'base.sin' )
131+
```
132+
133+
to see the documentation for the 'base.sin' function.
134+
135+
---
136+
137+
On the previous slide, you specified the alias via a string representing the
138+
alias name.
139+
140+
You can also provide a reference pointing to the aliased value.
141+
142+
For example, run
143+
144+
```javascript
145+
help( base.sin )
146+
```
147+
148+
to see the same documentation as before.
149+
150+
---
151+
152+
Additionally, for objects having known methods, you can print method
153+
documentation.
154+
155+
For example, run
156+
157+
```javascript
158+
help( base.random.randu.factory )
159+
```
160+
161+
to see the `factory()` method documentation.
93162

94163
---
95164

96-
TODO: help and docs
165+
Lastly, for select objects having a known constructor, you can provide
166+
instances.
167+
168+
For example, create a Float64Array
169+
170+
```javascript
171+
var x = new Float64Array( 10 );
172+
```
173+
174+
and then run
175+
176+
```javascript
177+
help( x )
178+
```
179+
180+
which will print the documentation for Float64Array.
181+
182+
---
183+
184+
The `help()` command provides detailed API documentation.
185+
186+
Sometimes, you just want to know the function signature and a brief
187+
description.
188+
189+
For this use case, you can use another command: `info()`.
190+
191+
For example, run
192+
193+
```javascript
194+
info( 'base.sin' )
195+
```
196+
197+
to see abbreviated API documentation for 'base.sin'.
198+
199+
---
200+
201+
Similar to `help()`, you can provide a variable reference.
202+
203+
For example, run
204+
205+
```javascript
206+
info( base.sin )
207+
```
208+
209+
to see the same abbreviated API documentation.
210+
211+
---
212+
213+
Another useful command is `example()`, which runs the example code found in
214+
the documentation printed by `help()`.
215+
216+
For example, run
217+
218+
```javascript
219+
example( 'base.sin' )
220+
```
221+
222+
to run the example code found in the documentation for 'base.sin'.
223+
224+
---
225+
226+
Similarly to `help()` and `info()`, you can provide a variable reference.
227+
228+
For example, run
229+
230+
```javascript
231+
example( base.sin )
232+
```
233+
234+
to again run the example code for 'base.sin'.
235+
236+
---
237+
238+
Finally, two other commands are useful when wanting to resolve aliases and
239+
package implementations.
240+
241+
To determine which package corresponds to a specified alias, use
242+
`alias2pkg()`.
243+
244+
For example, run
245+
246+
```javascript
247+
alias2pkg( 'base.sin' )
248+
```
249+
250+
or
251+
252+
```javascript
253+
alias2pkg( base.sin )
254+
```
255+
256+
to resolve the package for 'base.sin'.
257+
258+
---
259+
260+
To determine which alias corresponds to a specified package, use
261+
`pkg2alias()`.
262+
263+
For example, run
264+
265+
```javascript
266+
pkg2alias( '@stdlib/math/base/special/sin' )
267+
```
268+
269+
to resolve the alias for '@stdlib/math/base/special/sin'.
97270

98271
---
99272

0 commit comments

Comments
 (0)