News for hackers. Stuff that matters.
Re:Clay – A language designed for generic programming by tomp on Monday July 29, 2013 @03:33AM (#6119784)
By "tuple", I mean a first-class object that has multiple elements; an immutable list of sorts (and by "first-class" I mean an object that can be stored into a variable). E.g. in python:

  key, value = {'a': 1}.iteritems().next()
I could also do:

  item = {'a': 1}.iteritems.next()
  key, value = item
which shows that tuples are first-class.

By "multi-value context" I mean treating expressions differently depending on their context; some contexts are then "multi-value". E.g. in go:

  v, ok = a[x]
Here, if `x` is present in `a`, `v` is assigned the value at `x`, and `ok` is `true`; otherwise, `ok` is `false`, and `v` is assigned the zero value of its type.

Note that I cannot do this:

  pair = a[x]
  v, ok = pair
as `pair = a[x]` has a different meaning in this context: it only returns the value at `x` (or the zero value), and gives no indication of whether `x` is present or not. So, the meaning of the expression `a[x]` changes depending on the context, which can be either "single-value" or "multi-value".
Re:Clay – A language designed for generic programming by KenoFischer on Wednesday July 31, 2013 @03:34AM (#6132356)
Note that this does work just fine in Julia however since tuples are first class objects ;)