A Strong Working Knowledge of K


Dennis Shasha
Courant Institute of Mathematical Sciences
Department of Computer Science
New York University
shasha@cs.nyu.edu
http://cs.nyu.edu/cs/faculty/shasha/index.html


Goal of the GUI




Basic Scoreboard

  • Suppose we want to design a scoreboard in k. We have a home team and a guest team and we have two scores.
  • The strings here indicate operations that occur when a button is hit.
  • Forms are a kind of display (like a box with numbers). Try playing with the arrangements.
    
    \d scores
    home: 0
    homeinc:"home+:1"
    homeinc..c:`button
    guest:0
    guestinc:"guest+:1"
    guestinc..c:`button
    
    / go up and set arrangement
    \d ^
    scores..c: `form / all the scores are a form
    scores..a: ,`home `guest  `homeinc `guestinc 
    	/ they have a horizontal arrangement
    scores..a: `home `guest  `homeinc `guestinc 
    	/ they have a vertical arrangement
    scores..a: (`home `homeinc;  `guest `guestinc)
    	/ they have a mixed arrangement
    `show $ `scores / Note that you must have the backquote on scores.
    	/ If you do `show $ scores, you won't get that and the arrangement
    	/ won't work, but some things will work.
    / As you increment and decrement, you will get different scores.
    
  • Note that one sets attributes on the whole scores form in the directory above.

    Change Colors


    Vectors of Scores


    Other Graphics, e.g. charts


    A Betting Game



    Home Has an Edge



    Bank


    Simple Spreadsheet


    Spreadsheet with Fixed Point


    Check Boxes



    Fonts (from Mike Whitney)