Chapter 1: K, P, SL
We’ve seen how to describe a row of knit and a row of purl. Next let’s look at ribbing and heel stitch.
A WORD ABOUT NAMES
Whenever we give something a name or refer to it by a name, we have to put the name in single quotes like this: ‘Bob’. It doesn’t matter what unique name we use, but you do have to remember two things. First, don’t put any spaces in it. Anyplace where you would put a space, feel free to put a hyphen instead ‘my-cool-name’ or just jam the words together like ‘myCoolName’. Second, don’t start it with a number. ‘1×1-rib’ starts with a 1 so we cannot use that name. Instead start it with a letter like ‘k1p1-rib’ or ‘rib-1×1′ etc.
*** Is this really true? I’ve started it with a number. Hm.
RIBBING
Here is how to cast on and knit an inch of 1×1 rib, then bind off.
co 24
Instruction 'rib-1x1' {
Row: repeat to end { k1, p1 }
}
repeat 'rib-1x1' until measures 1 in
nextRow: bo all sts
How would we do the same thing working in the round?
Here is how to cast on, join, and knit an inch of 1×1 rib in the round. Notice that we say “Round:” instead of “Row:”.
co 24
joinInRound
Instruction 'k1p1-round' {
Round: repeat to end { k1, p1 }
}
repeat 'k1p1-round' for 1 in
It’s also possible to assert in the Instruction that we are knitting flat or round. We just add the word flat or the word round, like this:
Instruction 'rib-1x1' flat { ... }
Instruction 'k1p1-round' round { ... }
HOW LONG TO REPEAT
There are several ways to express how long to repeat something.
In the “repeat”, you can say “until measures 1 in” to tell someone how long the whole article is supposed to be, or you can say “for 1 in” to tell someone how long just that bit of pattern is supposed to be.
repeat 'my-ribbing-cuff' for 1 in repeat 'my-long-scarf' until measures 300 cm
If you want to tell them how many times to repeat it, you can say
repeat 'my-cool-texture' 7 additionalTimes
We haven’t covered increasing and decreasing yet, but when we do,
you’ll want to know how to repeat a set of rows/rounds until some
number of stitches remain:
repeat 'my-decrease-instructions' until 20 sts remain
SLIP STITCHES
We’ve covered knit and purl in the same row. Let’s look at slip stitches next. For our example we’ll look at heel stitch.
If you’re familiar with heel stitch you know that slipped stitches and knitted stitches alternate within a row, followed by (when knitting flat) a row of purl. The slipped stitches all line up in columns, since we are always slipping the same stitch that was slipped in the previous right-side row (unlike eye of partridge in which they are staggered, always slipping the stitch that wasn’t slipped in the previous right-side row.)
Here is heel stitch (over an even number of stitches) knit flat and starting with a right-side row.
Instruction 'heel-stitch' flat {
Row 1 rightSide: sl 1, repeat to 1 before end { k1, sl 1 }, k1
Row 2: p to end
}
repeat 'heel-stitch' until measures 1 in
Notice that you can add a number to your “Row” and that you can say whether it is a rightSide row. These useful things will be shown to the knitter in the human-language pattern that you generate.
I could just as well have said
Row: repeat to end { sl 1, k1 }
instead of
Row: sl1 , repeat to 1 before end { k1, sl 1 }, k1
but I wanted to show how to have some stitches before and after a repeat.
Stitches are slipped purlwise by default. You can also slip them knitwise
sl 1 knitwise
If you are slipping stitches on the wrong side you might want to distinguish which way you are carrying the working yarn, in front or behind:
sl 1 wyif sl 1 wyib sl 1 knitwise wyib
and so on.
LABELS AND COMMENTS
What if we want knitters to see what we are calling this stitch pattern? The unique names we’re using are seen only by the computer and by hard-core people who are reading our KnitML pattern code. When we generate the pattern in English (or another language) these names aren’t seen. We have the option of adding a label that *will* be seen. You use them like this:
Instruction 'heel-stitch' withLabel "Heel Stitch" {
...
}
After the keyword withLabel, we put the label text in double quotes “like this”. It can have spaces, as you see.
What if we want to say something to those aforementioned hard-core people, but don’t want the computer or regular knitters to see it? We can add comments to our code like this:
// This is a comment and the computer will ignore it
Instruction 'heel-stitch' withLabel "Heel Stitch" {
...
}
If you are familiar with programming these comments will probably seem natural to you. If they look unfamiliar, all you need to know is that when the computer is reading a line of your code, it will ignore everything from “//” to the end of the line.
Instruction 'k1p1-round' {
// This is a comment.
Round: repeat to end { k1, p1 } // This is another comment.
}
It’s a good idea to write some comments so that your future self will be reminded of any assumptions you were making or any thoughts you had. Be kind to your future self.
// The following will only work if there are an even number of
// stitches and the moon is full on a Tuesday:
Instruction 'my-cool-instruction' {
...
}
When you have a lot of close-braces ‘}’ it can be helpful to put a comment after each one saying what it is closing. This way when you are adding to your pattern or removing things from your pattern, you don’t lose track of where you want to put them or of how many braces ‘{’ are open and need to be closed.
Instruction 'blah' {
Row {
k1, p1, // etc.
} // end Row
} // end Instruction 'blah'
// and so on
EXERCISES:
Try these yourself before looking at the answers. Assume you are knitting
over an even number of stitches unless otherwise indicated.
1. Write the cast-on and instruction block for 1×1 rib knit flat over an odd number of stitches (e.g. if we had cast on 25 stitches.) What happens in the editor if you mis-match an odd cast-on and an even stitch pattern (or vice versa)? Also, try removing a close-brace ‘}’ and see what error message you get when you try to render the pattern. It’s a good idea to be familiar with error messages because it makes them easier to recognize and fix when you have a typo or other mistake.
2. Write the Instruction block for 2×2 rib knit flat.
3. Write the Instruction block for 3×1 rib knit in the round. Use the “round” keyword to say that it is round. What happens in the editor if you try to render this in a pattern after you have cast on 24 sts (or any other multiple of 4) and have not joined in the round?
4. Write the instruction block for eye of partridge knit flat. (You will need to write twice as many rows as we used to write heel stitch.) Decide whether to slip the stitches purlwise or knitwise and add a comment explaining your decision. Label your instruction “Eye of Partridge”.
5. For your instruction block in #1, write a repeat statement that means “keep going until the whole thing measures 4 inches” or, if you prefer, 10 centimeters.
6. For your block in #2, write a repeat statement that means “do this 4 more times.”
ANSWERS:
1.
Instruction 'my-1x1-rib-revisited' flat {
Row: k1, repeat to end {p1, k1}
Row: p1, repeat to end {k1, p1}
}
2.
Instruction 'my-2x2-rib-flat' flat {
Row: repeat to end { k2, p2 }
}
3.
Instruction 'my-3x1-rib-round' round {
Round: repeat to end { k3, p1 }
}
4.
// I prefer the twisted variation in which stitches are slipped knitwise
Instruction 'eye-of-partridge-flat' withLabel "Eye of Partridge" flat {
Row: repeat to end { sl 1 knitwise, k1 }
Row: p to end
Row: repeat to end { k1, sl 1 knitwise }
Row: p to end
}
5.
repeat 'my-1x1-rib-revisited' until measures 4 in
6.
repeat 'my-2x2-rib-flat' 4 additionalTimes
TERMS
Each chapter will contain a (rather hasty at present) list of the terms in Appendix B. Knitting Expression Language Reference that have been introduced in that chapter.
co
// comments
Instruction (we first saw Instruction in chapter 0): flat vs. round; withLabel
joinInRound
nextRow
repeat (after Instruction): __ additionalTimes, for ___ (in, cm), until __ sts remain
repeat (within Row): to end, to __ before end
round
sl (knitwise, wyif, wyib)