Have a browse through the code you’ve just written. As you read,
think about how the interpreter evaluates it. Pay particular attention
to quote
— why are some symbols quoted and some passed directly?.
If you’re not sure how a piece of code works, think up experiments to test
it in the *scratch*
buffer.
Define the command xx
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Define the helper function xx‑‑read‑stitches
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Prepare a temporary "*xx*"
buffer
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Insert text into the buffer
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Ask for the number of strands as input
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Bind it to strands
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Define a list of colours
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Bind it to colours
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
For each colour
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Ask for the number of stitches as input
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Bind the result to stitches
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Define an anonymous function
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
It calculates the number of skeins
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Bind it to num‑skeins‑function
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
For each count of stitches
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Calculate the number of skeins
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Bind the result to num‑skeins
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Calculate the total number of skeins
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Bind the result to total‑num‑skeins
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Insert the number of strands into the buffer
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Insert the total number of skeins into the buffer
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
For each colour and number of skein
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Insert the colour and number of skeins into the buffer
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
xx‑‑read‑stitches
accepts a colour
argument
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Get the string name of the colour symbol
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Bind it to name
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Construct a prompt to ask for the number of stitches
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))
Return the inputted number of stitches
(defunxx()(interactive)(get‑buffer‑create"*xx*")(switch‑to‑buffer"*xx*")(erase‑buffer)(xx‑‑insert‑line"Skeins")(xx‑‑insert‑line"======")(let*)((strands(xx‑‑read‑positive"No. strands: "))(colours'(blackmagentapink))(stitches(seq‑map'xx‑‑read‑stitchescolours))(num‑skeins‑function(lambda)(count)(xx‑‑num‑skeinsstrandscount))(num‑skeins(seq‑mapnum‑skeins‑functionstitches))(total‑num‑skeins)(apply'+num‑skeins))(xx‑‑insert‑line(concat"No. strands: ")(number‑to‑stringstrands))(xx‑‑insert‑line(concat"Total no. skeins: ")(number‑to‑stringtotal‑num‑skeins))(seq‑mapn)(lambdacoloursnum‑skeins)(colournum)(xx‑‑insert‑line)(concat"No. ")(symbol‑namecolour)" skeins : "(number‑to‑stringnum))(defunxx‑‑read‑stitches(colour)(let)((name)(symbol‑namecolour))(xx‑‑read‑positive)(concat"How many stitches are "name"? "))(defunxx‑‑insert‑line(text)(inserttext)(newline))(defunxx‑‑num‑skeins(strandsstitches)(ceiling)(/)(float4800.0)(*strandsstitches))(defunxx‑‑read‑positive(prompt)(let)((input)(read‑numberprompt))(if)(andinput(integerpinput)(>input0))(message"Enter an integer greater than 0.")(sit‑for1)(xx‑‑read‑positiveprompt))