Settings

Theme

Introduction to Code Golf and Golflangs

blog.vero.site

2 points by thetrustworthy 3 years ago · 1 comment

Reader

082349872349872 3 years ago

> operations that “naturally” take more than two parameters, that can’t be decomposed into reasonable two-parameter functions, are surprisingly rare. Simple examples include:

  String substitution: in string X, replace Y with Z.
  String padding: pad a string X to width at least Y with character Z.
  Dictionary update: given a dictionary D, set D[X] = Y.

The obvious solution here is to have a two-parameter function that serves as a product, combining two arguments into one (eg space-based stranding in APL-likes):

    (Y ⨂ Z) replace X
    (Y ⨂ Z) pad X
    D update X ⨂ Y

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection