Advertisement
Guest User

K quick reference

a guest
May 1st, 2018
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. # K quick reference
  2. Adapted from http://kparc.com/k.txt
  3.  
  4. ### Verbs (functions):
  5. Functions are overloaded, and can be used
  6. in both a unary and binary way.
  7. `# (1 2 3)` - `#` is used in the unary way, meaning `head`, and returns `1`.
  8. `2 # (1 2 3)` - `#` is used in the binary way, meaning `take`, and returns `(1 2)`.
  9.  
  10. (unary) (binary)
  11. : assign
  12. + flip plus
  13. - negate minus
  14. * first times
  15. % sqrt divide
  16. ! enum|key mod|map
  17. & where min|and
  18. | reverse max|or
  19. < asc less
  20. > desc more
  21. = group equal
  22. ~ not match
  23. , enlist concat
  24. ^ null except
  25. # count take|rsh
  26. _ floor drop|cut
  27. $ string cast|sum
  28. ? distinct find|rnd
  29. @ type at
  30. . eval|val dot
  31.  
  32.  
  33. ### Adverbs (higher order functions):
  34. ' each
  35. / over|join / fold
  36. \ scan|split
  37. ': eachprior / eachpair
  38. /: eachright
  39. \: eachleft
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement