Learn Practice Daily golf Reference
Macros·Lesson 5 of 5·10 min·0/7 exercisesPro

Counters and the great reformat

A card can count: copy the number from the line above, put it on this line and Ctrl-a it. Then the great reformat: 500 orders around the totals, and a numbered pick list.

Scene

Monday, 4:30 p.m. Two jobs before you go home: the kitchen's pick list for tomorrow, numbered line by line, and then the real run on all 500 orders. You could type the first few numbers. You won't type the rest.

A card can't hold every number. It can hold a way to work out the next one.

From memory

Warm-up from earlier chapters

Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.

Cook card a on the whole file.
press the keys…12 keys
1 of 2
Cook card a on the whole file.

A card that counts

Write the first number by hand: 1. on the first line. Then, on the second line, write a card that reads the number on the line above and clicks the tally counter: k0 yf␣ copies 1. , j0 P puts it at the start of this line, 0 Ctrl-a makes it 2, and j moves on. The card never changes, but each cook reads the line above, so every line gets the next number.

Before
1. al-pastor x2
veggie x1
birria x3
pollo x1
tinga x2
qak0yf␣j0P0Ctrl-ajq
1. al-pastor x2
2. veggie x1
birria x3
pollo x1
tinga x2
@a
1. al-pastor x2
2. veggie x1
3. birria x3
pollo x1
tinga x2
@a
1. al-pastor x2
2. veggie x1
3. birria x3
4. pollo x1
tinga x2
Written on line 2, cooked twice: 2, 3, 4.
Try it

Number the pick list

Eight lines for the kitchen's pick list. I 1. Esc on the first by hand, then j, write the counting card, and cook it on the other six.

Fix the marked spots · 8 left
1al-pastor x2
1veggie x1
2birria x3
3pollo x1
4tinga x2
5chorizo x1
6barbacoa x2
7carnitas x4
NORMALLoading the editor…0.0s1:1

This exercise needs a keyboard. Read on, and play it at your computer.

Check yourself

Which number goes up?

11. veggie x1
NORMAL
Keys pressed: Ctrl-a

The cursor is on the 1 of x1, after the 1. at the start. You press Ctrl-a. What does the line say?

Pick an answer (or press its number), then watch the engine prove it.
Check yourself

Nine to ten

19. tinga x2
2chorizo x1
NORMAL
Keys pressed: k0yf␣j0P0Ctrl-a

The card never changes; it copies whatever the line above says. Line 9 says 9. tinga x2. You cook the card on the chorizo line. What does it say?

Pick an answer (or press its number), then watch the engine prove it.
Boss round

The great reformat · 500 orders

4:45. The whole export: 500 rows, with a hand-typed TOTAL line after every fifty. Every order row becomes { id: …, item: "…" },, and every TOTAL line stays exactly as typed. First a sample: write the card on the first row and test it once on the second. Then the other 498 rows, without touching a TOTAL. Afterwards, /TOTAL↵ and a few n will show you whether they all survived.

Stuck? Show a hint
Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

This exercise needs a keyboard. Read on, and play it at your computer.

Boss round

The great reformat · The pick list

5:20. The kitchen's pick list for tomorrow, thirty lines: number them 1 to 30.

Stuck? Show a hint
Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

This exercise needs a keyboard. Read on, and play it at your computer.

Monday, 5:40 p.m.Finish the exercise above to see it.
From memory

The whole track, from memory

Six situations from today.

Start writing card q.
scroll here, then press the keys2 keys
1 of 6
Start writing card q.