w a c k o 2 k [MUF Talk]   t u t o r i a l s  


Small discussion tutoring P"aul in MUF on 2/8.
If any of this is unclear, please let me know so I can elaborate on it.

Originally, P"aul was just going to ask me questions about the MUF tutorial
------------------------------------------------------------------

You say, "okay, I'm logging.  ask away"
P"aul says, "What does the first paragraph mean?"
P"aul says, "about the stack."
You say, "you know those things in cafeteria that hold plates?"
You say, "where you take off the top one, and the rest kind of popup?"
P"aul says, "Yep"
You say, "that's a stack"
P"aul says, "K"
You say, "basically, you only use the top 'plates' of the stack"
P"aul says, "Right"
You say, "real quick example.  here's how to add 2+3 with a stack language:"
You say, "    2 3 +"
You say, "you put a dish with the number 2 on the stack"
P"aul says, "right"
You say, "then put a dish with the number 3 on the stack"
P"aul says, "K"
You say, "the + operator takes the two top dishes and adds their numbers 
together, and puts a dish with that number on the stack"
P"aul says, "Is there a way to test that."
You say, "yes."
P"aul says, "I understand but I want to test it out."
P"aul says, "How do I do it?"
You say, "Now, you must know a few quick things to do the program."
P"aul says, "K"
You say, "first of all, the program looks like this:"
: main
 2 3 +
;
You say, "all muf programs must have    : "
You say, "and a ; to show that the procedure is done."
P"aul says, "uh huh."
P"aul says, "Ok"
You say, "all muf programs must have 1 procedure.  the last procedure is the one 
that is run."
You say, "okay?"
P"aul says, "OK"
You say, "Now, for the most part, spaces and returns don't matter."
You say, "the same program can be written like this:"
 : main 2 3 + ;
You say, "but a) it's ugly, and b) harder to udnerstand."

P"aul says, "So I would just type that?"
You say, "not exactly."
P"aul says, "Ok"
P"aul says, "How would I do that?"

You say, "okay, -very- brief instructions on how to use the editor"
P"aul says, "OK"
You say, "for now, until you get harder programs, know this:"
You say, "1)  To create/edit a muf program:      @prog "
You say, "that puts you in the editor"
You say, "to quit the editor, you use:   q"
You say, "Look, just try it:    do:  @prog test, then do a q."
You say, "then look at your inventory"
P"aul says, "K"
P"aul says, "I did it."
P"aul says, "What will be in my inventory"
You say, "congrats, you made a zero line program"
P"aul says, "Oh yeah"
P"aul laughs

P"aul says, "How do I change the program for it?"
You say, "to insert a line into a program, you do:"
You say, "   i"
You say, "meaning, I am going to enter lines starting with line #n"
You say, "it also means, I am going to be entering lines until I do a . to quit"
You say, "like the mail program"
P"aul says, "U lost me."
P"aul says, "the  i part"
You say, "okay, let's say the program looks like this:"
line1
line2
line3
You say, "okay, now assume I type the following:"
You say, "  2 i"
You say, "  this is the new line #2"
You say, "  this is the new line #3"
You say, "  ."
P"aul says, "K"
You say, "the program now lookks like:"
line1
this is the new line #2
this is the new line #3
line2
line3
P"aul says, "OK"

You say, "you can delete lines by doing:       d"
You say, "delete lines from lines n1 to lines n2"
P"aul says, "so I would type  d"
P"aul says, "and that would delete line 1"
You say, "no, you type:   1 1 d   to delete line 1"
P"aul says, "K"
P"aul says, "same for line 2?"

P"aul says, "I typed 1 1 d and it didn"t do anything."
You say, "might be   l, I foret"
You say, "to view lines n1 to lines n2"

P"aul says, "do I use the <>?"
You say, "no, you use actual digits."
P"aul says, "HUh?"
You say, "anytime I use <> it's a variable"
P"aul says, "K"

P"aul says, "What are the digits?"
You say, "whatever line neumbers you want to view"
You say, "view lines 5-200 = 5 200 v"
You say, "just try different numbers till it makes sense"
You say, "practice inserting/deleting/viewing for a bit"

P"aul says, "I type: 5 200 v"
P"aul says, "nothing happened"

You say, "you have to do:  @Prog   to get in the editor before 
editor commands work"
P"aul says, "How do I make a program?"
You say, "@prog both creates and edits programs."
P"aul says, "Name a simple program"
You say, "call it whatever you want.  It's just like @create"
P"aul says, "K"
P"aul says, "But when I go to it what should I do?"
P"aul says, "the editor that is."
You say, "first of all, in the editor do:  n"
You say, "that lists line numbers"
You say, "then try inserting 5 lines of text, as if it was a program"
P"aul says, "It says illegal editor command."
P"aul says, "N worked"

P"aul says, "Everything I type is an illegal editor command."
You say, "what are you tphing?"
P"aul says, "Just stuff"
P"aul says, "like blah blah blah"
P"aul says, "And stuff like that."
You say, "No, you have to go into 'insert' mode"
You say, "you can't just type stuff.  you have to tell it you're inserting lines 
into the program"
P"aul says, "did it"
P"aul says, "Now what."
P"aul says, "I did the insirt"

You say, "pretend you made a typo in the 2nd line and try to replace it with 
something else"
You say, "by deleteing the line and replacing it"
P"aul says, "K"
You say, "delete:   2 2 d"
P"aul says, "Ohh"
You say, "insert new #2:  2 i"
You say, "then a . when you're done typing th eline"
You say, "make sure you can fix typos in lines easily, because you're going to 
make a ton of them."

P"aul says, "I can"t delete in insert mode but only in the normal mode right?"
You say, "correct.  you must leave insert mode to delete."

P"aul says, "How do I know how many lines I have and what is on them?"
You say, "I don't know how to list how many lines"
You say, "a simple but silly way is to do:   1 500 v"
You say, "er, sorry:  1 500 l"
You say, "list all lines from 1 to 500"
You say, "it'll stop when it hits your last line, assuming it's < 500"

P"aul says, "and to delete the lines I type 1 1 d"
P"aul says, "to delete line 1"
You say, "right.  1 1 d deletes all lines from line 1 to line 1."
P"aul says, "K"
P"aul says, "Got that down."
P"aul says, "Prety well"


You say, "okay, good."
You say, "now try entering the following program:"
: main
  2 3 +
;
You say, "uh, insert those lines into the program"
P"aul says, "Did that."
P"aul says, "Now what?"
You say, "okay.  Now, go into the editor and type:   c"
P"aul says, "Error in line 1."
You say, "what is line 1?"
P"aul says, "unrecognized word :main"
You say, "you need a space after the :"
P"aul says, "Oops"
P"aul says, "K I did that."
You say, "compiled with no complaints?"
P"aul says, "Compiler done."
You say, "excellent."

P"aul says, "What did that do?"
You say, "Compiler done means:   The compiler checked your program to make sure 
it works, and it shuld run without errors.  Not that it's necessarily going to 
do what you want.  :P"

You say, "now, run the program.  To run the program, make an exit, and link it 
to the program."
P"aul says, "Nothing?"
P"aul says, "an exit?"
P"aul says, "like a room exit?"
You say, "yes, a room exit."
You say, "how do you normally make exits?  for rooms?"
You say, "by the way, how old are you?"
P"aul says, "@open and bubsy's age"
P"aul says, "13"
. nods.

You say, "An exit has a source, and something it connects to."
P"aul says, "Yep"
You say, "when an exit connects to a room, when you 'use' the exit,  you move to 
the connected room."
You say, "right?"
P"aul says, "correct"
You say, "Did you knowthat exits can connect to objects?"
P"aul says, "NO"
P"aul says, " I didn"t know that."
You say, "well, you can.  And when you 'use' the exit, it brings the object to 
the source of the exit."
You say, "usually a room or a person."
P"aul says, "So"
P"aul says, "umm"
P"aul says, "K"
P"aul says, "so If i were to link an exit to dog crap whenever someone used the 
exit the dog crap would tel to them?"
You say, "no.  it would put the dog crap to wherever the source of the exit is."
P"aul says, "You lost me."
P"aul says, "The source of the exit would be?"
You say, "when you make an exit, you first have to make the exit -on- 
something."
You say, "right?"
P"aul says, "K"
P"aul says, "The source is a room right?"
You say, "it doesn't have to be.  The exit can be on yourself."
P"aul says, "K"
You say, "the exact syntax is:   @action  = "
P"aul says, "But if the exit to dog crap was in this room the dog crap would 
come here."
You say, "correct."
P"aul says, "K"
P"aul says, "got it"

You say, "so, going back to the original topic,"
You say, "if the exit is on -you-, then only you can run the program.  If the 
exit is on a room, then anyone in the room can run the program."
You say, "after you make an exit on something, you then use:  @link  = 
"
You say, "got it?"
P"aul says, "I think"
You say, "well, play with it till get an exit linked to your program"
P"aul says, "K"
P"aul says, "I did it"


You say, "okay.  run the program.  by doing 'test'"
P"aul says, "Nothing happens."
You say, "right."
You say, "to get output, you need to have lines in your program that say, 'by 
the way, give me some output'"
You say, "but for now, do this:"
P"aul says, "K"
You say, "  @set  = D"
P"aul says, "@set test=D"    /*** NOTE:  that's what he called the prog ***/
You say, "yes."
P"aul says, "K"

Ways ta go -> Oops   /*** Oops is linked to his test program ***/
Contents:
P"aul(#16863PBM)
P"aul says, "WHoa"

/*** output ***/
D(#13485 L2) S("") 2
D(#13485 L2) S("", 2) 3
D(#13485 L2) S("", 2, 3) exit
P"aul says, "i don"t have a clue what it did."

You say, "okay, I'm going explain line 1 piece by piece.  tell me when you don't 
understand, okay if you do."
P"aul says, "K"
You say, "Part 1:  D(     )     <---What you are debugging"
P"aul says, "OK"
You say, "  #13485 L2   <--- you are debugging program #13485.  Ignore the L2 
part"
P"aul says, "OK"
You say, "Next part:   S(        )    <-- the contents of the stack"
P"aul says, "OK"
P"aul says, "Wait"
P"aul says, "The contents are the lines I typed, right?"
You say, "no."
You say, "the lines you typed are the program."
P"aul says, "K"
You say, "the program does things to the stack"
You say, "okay?"
P"aul says, "So the program controls the stack?"
You say, "right."
P"aul says, "K"
P"aul says, "so what are the contents?"
You say, "well,at the begining, the stack has only whatever you typed when you 
ran the program"
You say, "notice the difference between:  "oops"  "oops test1"  "oops test2" and 
"oops test1 test2""
P"aul says, "right"

You say, "get it?"
P"aul says, "K"
P"aul says, "Yep"
P"aul says, "brb"

/* outputs, in order of 'oops' oops test1', oops test2, and oops test1 test2*/
D(#13485 L2) S("") 2
D(#13485 L2) S("", 2) 3
D(#13485 L2) S("", 2, 3) exit
D(#13485 L2) S("test1") 2
D(#13485 L2) S("test1", 2) 3
D(#13485 L2) S("test1", 2, 3) exit
D(#13485 L2) S("test2") 2
D(#13485 L2) S("test2", 2) 3
D(#13485 L2) S("test2", 2, 3) exit
D(#13485 L2) S("test1 test2") 2
D(#13485 L2) S("test1 test2", 2) 3
D(#13485 L2) S("test1 test2", 2, 3) exit
P"aul says, "back"
You say, "okay.  understand the S(  )?"
P"aul says, "Yep"


You say, "okay.  then you have the 2.    Since it's line 1, 2 is the first 
command on the first line of your program"
P"aul says, "K"
You say, "remember, to MUF:   2 3 +"
You say, "and 2"
You say, "3"
You say, "+"
You say, "is the same thing.  it ignores returns & such"
You say, "okay?"
P"aul says, "K"
You say, "line 1 all clear?"
P"aul says, "yep"
P"aul says, "i think I understood the rest."
You say, "right.  it just walks through."


You say, "try this program:"
You say, "  1 2 3 + + "
P"aul says, "K"
You say, "well:     : main 1 2 3 + + ;"
P"aul says, "On the same line?"
P"aul says, "Or as before?"
You say, "it doesn't matter, remember?"
. grins
P"aul says, "did it."
P"aul says, "It looks the same"
You say, "hmm"
P"aul says, "I Think"
You say, "uh, did you compkile the program?"
P"aul says, "compkile?"
You say, "compile.  with c."
P"aul says, "nope"
P"aul says, "now"
P"aul says, "I did now"
You say, "program has to be compiled to run"
D(#13485 L1) S("") 1
D(#13485 L1) S("", 1) 2
D(#13485 L1) S("", 1, 2) 3
D(#13485 L1) S("", 1, 2, 3) +
D(#13485 L1) S("", 1, 5) +
D(#13485 L1) S("", 6) exit
P"aul says, "Whoa"
P"aul says, "It is different"
P"aul says, "I see what it is doing"
P"aul says, "I understand that now."


P"aul says, "it gets the 1 2 and 3 then the +"
. nods
P"aul says, "Then they put the 2&3 toghether and + the 1"
P"aul says, "Then it gets a  6"
. nods
P"aul says, "Confusing"
P"aul says, "K"
P"aul says, "NOw"


You say, "well, see how far you can get through the tutorial now"
P"aul says, "k"
P"aul says, "Hmm?"
P"aul says, "The tutorial doesn"t make any sense still but you do."
. laughs
You say, "okay, let me explain the tutorial"


P"aul says, "I am to the part called swap"
You say, "swap (x y -- y x)?"
You say, "do you understand the syntax of:  (x y -- y x )?"
P"aul says, "I don"t understand the syntax thing."
You say, "okay"
You say, "there's one important bit of information before that."
You say, "the number 2, the string "2" and the dbnumber  #2 are all totally 
different."
You say, "is that clear?"
P"aul says, "Nope"
P"aul grins


You say, "later, you can make variables"
You say, "so you can say"  x=4"
You say, "and later do:   x=x+1"
You say, "or whatever"
P"aul says, "UMM OK"

You say, "now.  you can also do things with strings"
P"aul says, "LIke?"
You say, "like :  display a string on th escreen to a character"
You say, "like spoof."
P"aul says, "K"
P"aul says, "ANy examples?"

You say, "well, anything in double quotes is a stiring:"
You say, "      "hi"   "string"   "three word string""
You say, "strings can have spaces"
P"aul says, "Lost me"
You say, "look at your 'oops' program when you do:  'oops test'"
D(#13485 L1) S("test") 1
D(#13485 L1) S("test", 1) 2
D(#13485 L1) S("test", 1, 2) 3
D(#13485 L1) S("test", 1, 2, 3) +
D(#13485 L1) S("test", 1, 5) +
D(#13485 L1) S("test", 6) exit
P"aul says, "K"
You say, "it reads in the string "test" and puts it on the sstack"
P"aul says, "Yep"
You say, "see?"
P"aul says, "Yep"
You say, "good."

You say, "does it make sense to say:   2+3?"
P"aul says, "Yep"
You say, "right."
P"aul says, "K"
You say, "does it make sense to say:    "green" + "blue"?"
P"aul says, "No"
You say, "right."
P"aul says, "Greenish-blue?"
You say, "you're thinking about it in the wrong way"
P"aul smiles
You say, "you can only add numbers"
P"aul says, "right"
You say, "you can't add words."
P"aul says, "so what is green?"
. aooga
You say, "it's a string."
P"aul says, "So I could make it a number?"
You say, "you can make it LOOK like a number, but it is still a string"
P"aul says, "K"


You say, "think about it this way"
You say, "a variable must be eitehr a number, or a word."
P"aul says, "right."
You say, "you can add numbers."
You say, "you can display words"
P"aul says, "yeah"

You say, "in fact, to display, the syntax is:"
You say, "        notify"
P"aul says, "What is the notify?"
You say, "it's a muf command, like +"
P"aul says, "k"
You say, "so, the following is legal:    #2   "hi"  notify"
You say, "#2 is my db#"
P"aul says, "db?"

/** I do:  ex oops ***/
Oops(#16251E)  Owner: P"aul
Type: EXIT/ACTION
Key: *UNLOCKED*
Source: Idleboot Headquarters(#9705R)
Destination: Test(#13485FD)
Oops(#16251E)  Owner: P"aul
Type: EXIT/ACTION
Key: *UNLOCKED*
Source: Idleboot Headquarters(#9705R)
Destination: Test(#13485FD)

You say, "The database number of OOps is #16251"
You say, "that's what I mean by db#"
P"aul says, "K"
You say, "so:    #2 "hi"  notify    is legal.  right?"
P"aul says, "Um"
P"aul says, "K"
P"aul says, "Got it."

You say, "  #2  "8"  notify"
You say, "is also legal."
P"aul says, "I think"
P"aul says, "Yep"

You say, "now:    #2  8  notify     is NOT LEGAL"
You say, "8 is a number.  It is not a word."
P"aul says, "because it doesn"t have the quatation, RIGht?"
You say, "correct."

You say, "the important thing, for now,"
You say, "is to know that:  2  and "2"  and #2   are different."
P"aul says, "I got that."
You say, "one is a nubmer.  one is a word.  one is the db#"
P"aul says, "the 2 "2" and #w"
P"aul says, "Yep"


You say, "now, to understand functions, you need to learn the headers."
P"aul says, "K"
You say, " for +, the description is:  (i1  i2 -- i )"
P"aul says, "umm?"
You say, "the generic description is:  (  oldstack  -- newstack )"
P"aul says, "K"
You say, "For the most part, functions do something to the top of the stack, and 
replace it with something else."
P"aul says, "right"
P"aul says, "Like the plates at the cafeteria"
You say, "right."
You say, "now, think back.  what does the  S(1, 2) + do?"
You say, "it returns   S(3).  right?"
P"aul says, "that adds them "
P"aul says, "It adds the 1 and 2"
P"aul says, "and the stack replaces them with a 3"
You say, "actually, the + puts the 3 back onto the stack when it's done."
P"aul says, "Ohh"
You say, "that is why the description is:  (i1 i2 -- i)"
You say, "because it sucks up i1 and i2;   then it puts back a new  i"
You say, "i being an integer."
P"aul says, "K"

P"aul says, "Got that."
You say, "the numbers are important, because i1, i2, and i are totally 
diffferent numbers"
P"aul says, "how are they different numbers besides 1 and 2"
P"aul says, "or is that all"
You say, "they're just different.  "
You say, "that's it.  the desc can just as easily be (i3 i4 -- i2)"
You say, "although that'd be kinda weird"
P"aul says, "K"

You say, "okay.  "
You say, "by ther way, there is a command called 'pop'"
P"aul says, "pop?"
You say, "it basically takes the top plate and throws it away"
P"aul says, "K"
You say, "    S(1,2) pop =   S(1)"
P"aul says, "got it."
You say, "The description of pop is:   ( x -- )"
You say, "x can be anything - number, db# or word"
P"aul says, "K"


You say, "now, swap."
You say, "Swap's description is:   (x y -- y x)"
P"aul says, "swap?"
P"aul says, "K"
You say, "i.e. it 'flips' the top two plates"
P"aul says, "so it switches the 1 and the 2"
You say, "yes,   S(1,2) swap = S(2,1)"
You say, "and   S(1,2,3) swap = S(1,3,2)"
P"aul says, "K"
You say, "notice in the description:  (x y -- y x).  same letters, same values"
P"aul says, "yep"
You say, "okay, understand swap?"
P"aul says, "yep"
You say, "okay.  "


P"aul says, "would this be a good time to stop?"
. laughs
You say, "yeah, good time."
P"aul smiles
You say, "better time would be about 3 hours ago, actually"
P"aul says, "Must go"
P"aul says, "Thanks for the help"
You say, "i'll stick this log file on the web page"
P"aul says, " You are a great tutor"
You say, "for your reference"
P"aul says, "K"
P"aul falls down on the ground lifeless.  Well I guess that"s what happens to 
you wacko-self when you go to RL.

--   [home]  [history]  [fun facts]  [tutorials]  [links]  [contact]  [telnet]   --


--- © 1999 by peter mackay and Indistinct Productions - all rights reserved ---