 
 $asArray = (val) -> if $_.isArray val then val else [val]
 $asFunction = (val) -> if $_.isFunction val then val else -> val
+
+$each = $_.each
+
+$first = (collection, def) ->
+  if (n = collection.length)?
+    return collection[0] unless n is 0
+  else
+    return value for own _, value of collection
+
+  # Nothing was found, returns the `def` value.
+  def
 
 $removeValue = (array, value) ->
   index = array.indexOf value

  $watch this, options, (entered, exited) ->
    prev = @value

    if not $_.isEmpty entered
      @value = entered[0]
    else
      @value = def unless keepLast

    @value isnt prev


      # Computes the current value.
      value = val.call item

      (valuesByNamespace[namespace] ?= {})[item.key] = value

    # Stops here if no values were computed.
    return if do ->
