Add some test cases that show that the idiom works.
Chris Pressey
4 years ago
266 | 266 | * If value is 5 then _a_ then _a_′ _b_ then _b_′ _c_ is executed. |
267 | 267 | * _a_ _a_′ _b_ _b_′ _c_ = _c_, so in effect, only _c_ is executed. |
268 | 268 | |
269 | So the idiom works out (in theory: now I need to write some test cases here.) | |
269 | We must also remember that each successive happens one cell to the | |
270 | right of the previous test (the cell being tested is the work cell of | |
271 | the previous test). So we may have to wrap the contents of the | |
272 | conditional with `<` and `>` one or more times, if we want all the | |
273 | conditionals to operate on the same cell. | |
274 | ||
275 | So it looks like the idiom works out. Let's write out some test cases | |
276 | to check that it actually does. | |
277 | ||
278 | Again we say the value to be tested is either 1, 3, or 5, and say we want | |
279 | to write 9 if it's 1, write 13 if it's 3, or write 7 if it's 5. | |
280 | ||
281 | The first part of this will be: | |
282 | ||
283 | ( | |
284 | +++++++++ | |
285 | >/ | |
286 | >)(/) | |
287 | ||
288 | The second part will be | |
289 | ||
290 | --( | |
291 | < | |
292 | --------- | |
293 | +++++++++++++ | |
294 | > | |
295 | >/ | |
296 | >)--(/) | |
297 | ||
298 | The third part will be | |
299 | ||
300 | ----( | |
301 | << | |
302 | ------------- | |
303 | +++++++ | |
304 | >> | |
305 | >/ | |
306 | >)----(/) | |
307 | ||
308 | Put it all together and try it with 1: | |
309 | ||
310 | | + | |
311 | | ( | |
312 | | +++++++++ | |
313 | | >/ | |
314 | | >)(/) | |
315 | | --( | |
316 | | < | |
317 | | --------- | |
318 | | +++++++++++++ | |
319 | | > | |
320 | | >/ | |
321 | | >)--(/) | |
322 | | ----( | |
323 | | << | |
324 | | ------------- | |
325 | | +++++++ | |
326 | | >> | |
327 | | >/ | |
328 | | >)----(/)<<< | |
329 | = State [9]<[0,0,1] [0]<[] True | |
330 | ||
331 | Try it with 3: | |
332 | ||
333 | | +++ | |
334 | | ( | |
335 | | +++++++++ | |
336 | | >/ | |
337 | | >)(/) | |
338 | | --( | |
339 | | < | |
340 | | --------- | |
341 | | +++++++++++++ | |
342 | | > | |
343 | | >/ | |
344 | | >)--(/) | |
345 | | ----( | |
346 | | << | |
347 | | ------------- | |
348 | | +++++++ | |
349 | | >> | |
350 | | >/ | |
351 | | >)----(/)<<< | |
352 | = State [13]<[0,0,3] [0]<[] True | |
353 | ||
354 | Try it with 5: | |
355 | ||
356 | | +++++ | |
357 | | ( | |
358 | | +++++++++ | |
359 | | >/ | |
360 | | >)(/) | |
361 | | --( | |
362 | | < | |
363 | | --------- | |
364 | | +++++++++++++ | |
365 | | > | |
366 | | >/ | |
367 | | >)--(/) | |
368 | | ----( | |
369 | | << | |
370 | | ------------- | |
371 | | +++++++ | |
372 | | >> | |
373 | | >/ | |
374 | | >)----(/)<<< | |
375 | = State [7]<[0,0,5] [0]<[] True |