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



Why is K Good?





Why is K Bad?







Unit 1: Basic Language Features




Data Types




Structuring Primitives: scalars, list/vector, dictionary




Monadic vs. Dyadic Operators






Read and Write Files




Arguments to Programs




Generate Data





Add, Subtract, Multiply, Divide, and Compare




Vectors to Scalars and to Other Vectors




Debugging




Time Functions



Exercises




Solution: Average




Solution: Variance




Functions can Make This Easier




Solution: Variance as a function




Exercises




Solution: Dot Product




Solution: Matrix Multiply


n: 100
x: (n*n) _draw 10000
m1: (n;n) # x / note that n n # x won't work because n n is function app
x: (n*n) _draw 10000
m2: (n;n)  # x

dot:{[x;y] +/x*y}

r: m1 dot/:\: +m2  / dot product with the transpose.






Note: adverbs



Solution: Present value revisited



Solution: Bank Balances



Advanced Topic