liftA3 :: Applicative m => (a -> b -> c -> d) -> m a -> m b -> m c -> m d
326890
function liftA3(fn, x, y, z) {
  if(!isFunction(fn)) {
    throw new TypeError('liftA3: Function required for first argument')
  }
  else if(!((isApply(x) || isArray(x)) && isSameType(x, y) && isSameType(x, z))) {
    throw new TypeError('liftA3: Applys of same type required for last three arguments')
  }

  if(isArray(x)) {
    return ap(z, ap(y, map(fn, x)))
  }

  return x.map(fn).ap(y).ap(z)
}
336370
function apply(t, m, a) {
    var l = a && a.length;
    if (!a || !l) {
      return m.call(t);
    }
    switch (l) {
      case 1:
        return m.call(t, a[0]);
      case 2:
        return m.call(t, a[0], a[1]);
      case 3:
        return m.call(t, a[0], a[1], a[2]);
      case 4:
        return m.call(t, a[0], a[1], a[2], a[3]);
      case 5:
        return m.call(t, a[0], a[1], a[2], a[3], a[4]);
      default:
        return m.apply(t, a);
    }
  }
74378
public F3<P1, P2, P3, Option<R>> lift() {
            final F3<P1, P2, P3, R> me = this;
            return new F3<P1, P2, P3, Option<R>>() {
                @Override
                public Option<R> apply(P1 p1, P2 p2, P3 p3) {
                    try {
                        return some(me.apply(p1, p2, p3));
                    } catch (RuntimeException e) {
                        return none();
                    }
                }
            };
        }
622513
def dot(a, b)
    a = NArray.asarray(a)
    b = NArray.asarray(b)
    case a.ndim
    when 1
      case b.ndim
      when 1
        func = blas_char(a, b) =~ /c|z/ ? :dotu : :dot
        Blas.call(func, a, b)
      else
        if b.contiguous?
          trans = 't'
        else
          if b.fortran_contiguous?
            trans = 'n'
            b = b.transpose
          else
            trans = 't'
            b = b.dup
          end
        end
        Blas.call(:gemv, b, a, trans:trans)
      end
    else
      case b.ndim
      when 1
        if a.contiguous?
          trans = 'n'
        else
          if a.fortran_contiguous?
            trans = 't'
            a = a.transpose
          else
            trans = 'n'
            a = a.dup
          end
        end
        Blas.call(:gemv, a, b, trans:trans)
      else
        if a.contiguous?
          transa = 'n'
        else
          if a.fortran_contiguous?
            transa = 't'
            a = a.transpose
          else
            transa = 'n'
            a = a.dup
          end
        end
        if b.contiguous?
          transb = 'n'
        else
          if b.fortran_contiguous?
            transb='t'
            b = b.transpose
          else
            transb='n'
            b = b.dup
          end
        end
        Blas.call(:gemm, a, b, transa:transa, transb:transb)
      end
    end
  end
1223423
def trimult(U, x, uplo='U', transa='N', alpha=1., inplace=False):
    
    if inplace:
        b = x
    else:
        b = x.copy('F')
    dtrmm_wrap(a=U, b=b, uplo=uplo, transa=transa, alpha=alpha)
    return b
341335
function Mat33(a, b, c) {
  if (typeof a === 'object' && a !== null) {
    this.ex = Vec3.clone(a);
    this.ey = Vec3.clone(b);
    this.ez = Vec3.clone(c);
  } else {
    this.ex = Vec3();
    this.ey = Vec3();
    this.ez = Vec3();
  }
}
622336
def expression(allow_assignments = true, wrapped = true, whitespace = true)
      buffer = ''

      # Build a ruby expression out of accepted literals
      while (term = (whitespace ? accept(:whitespace) : nil) ||
                    modifier ||
                    identifier ||
                    method_call ||
                    paranthesis ||
                    array ||
                    hash ||
                    symbol ||
                    percent ||
                    primary_term)
        buffer += term

        # Accept operations which have a right term and raise an error if
        # we have an unfinished expression such as "a +", "b - 1 >" and other
        # expressions following the same pattern
        if wrapped && (op = operation ||
          (allow_assignments ? accept_stripped(:exp_assignment) : nil))

          buffer += op
          if (right_term = expression(allow_assignments, wrapped)).nil?
            Logger.error :parse, @code, @i, @j, :expression
          else
            buffer += right_term[@value]
          end
        elsif (op = array || op = method_call || op = ternary_operator(allow_assignments, wrapped))
          buffer += op
        end

        # Do not continue if the expression has whitespace method calls in
        # an unwrapped context because this will confuse the parser
        unless buffer.strip.empty?
          break if lookahead(:exp_identifier_lookahead).nil?
        end
      end

      if buffer.strip.empty?
        undo buffer
      else
        [:expression, buffer.strip, {}]
      end
    end
150270
function tuple4Of(a, b, c, d) {
    var self = getInstance(this, tuple4Of);
    self.types = rest(arguments);
    return self;
}
555590
function dfl(a, b, c) {
        switch (arguments.length) {
            case 2: return a != null ? a : b;
            case 3: return a != null ? a : b != null ? b : c;
            default: throw new Error("Implement me");
        }
    }
888467
private int ssMedian3(int Td, int PA, int v1, int v2, int v3) {
        if (T[start + Td + SA[PA + SA[v1]]] > T[start + Td + SA[PA + SA[v2]]]) {
            int t = v1;
            v1 = v2;
            v2 = t;
        }
        if (T[start + Td + SA[PA + SA[v2]]] > T[start + Td + SA[PA + SA[v3]]]) {
            if (T[start + Td + SA[PA + SA[v1]]] > T[start + Td + SA[PA + SA[v3]]]) {
                return v1;
            } else {
                return v3;
            }
        }
        return v2;
    }
1346457
function merge( a, l, m, r ) {
    const n1 = m - l + 1;
    const n2 = r - m;
    const L = a.slice( l, m + 1 );
    const R = a.slice( m + 1, 1 + r );

    let i = 0, j = 0, k = l;
    while( i < n1 && j < n2 ) {
        if( L[ i ][ 0 ] <= R[ j ][ 0 ] ) {
            a[ k ] = L[ i ];
            i++;
        } else {
            a[ k ] = R[ j ];
            j++;
        }
        k++;
    }

    while( i < n1 ) {
        a[ k ] = L[ i ];
        i++;
        k++;
    }

    while( j < n2 ) {
        a[ k ] = R[ j ];
        j++;
        k++;
    }
}
1206678
function sub(a, b){
    return Vector3(a.x-b.x, a.y-b.y, a.z-b.z);
  }
1058652
function ceil(out, a) {
  out[0] = Math.ceil(a[0]);
  out[1] = Math.ceil(a[1]);
  out[2] = Math.ceil(a[2]);
  return out;
}
1248043
private static Substitution computeSomeHomomorphism(SubstitutionBuilder sb, List<Function> from, Map<Predicate, List<Function>> to) {

		int fromSize = from.size();
		if (fromSize == 0)
			return sb.getSubstituition();

		// stack of partial homomorphisms
		Stack<SubstitutionBuilder> sbStack = new Stack<>();
		sbStack.push(sb);
		// set the capacity to reduce memory re-allocations
		List<Stack<Function>> choicesMap = new ArrayList<>(fromSize);

		int currentAtomIdx = 0;
		while (currentAtomIdx >= 0) {
			Function currentAtom = from.get(currentAtomIdx);

			Stack<Function> choices;
			if (currentAtomIdx >= choicesMap.size()) {
				// we have never reached this atom (this is lazy initialization)
				// initializing the stack
				choices = new Stack<>();
				// add all choices for the current predicate symbol
				choices.addAll(to.get(currentAtom.getFunctionSymbol()));
				choicesMap.add(currentAtomIdx, choices);
			}
			else
				choices = choicesMap.get(currentAtomIdx);

			boolean choiceMade = false;
			while (!choices.isEmpty()) {
				SubstitutionBuilder sb1 = sb.clone(); // clone!
				choiceMade = extendHomomorphism(sb1, currentAtom, choices.pop());
				if (choiceMade) {
					// we reached the last atom
					if (currentAtomIdx == fromSize - 1)
						return sb1.getSubstituition();

					// otherwise, save the partial homomorphism
					sbStack.push(sb);
					sb = sb1;
					currentAtomIdx++;  // move to the next atom
					break;
				}
			}
			if (!choiceMade) {
				// backtracking
				// restore all choices for the current predicate symbol
				choices.addAll(to.get(currentAtom.getFunctionSymbol()));
				sb = sbStack.pop();   // restore the partial homomorphism
				currentAtomIdx--;   // move to the previous atom
			}
		}

		// checked all possible substitutions and have not found anything
		return null;
	}
615956
function extend( a, b ) {
	for ( var p in b ) {
		a[ p ] = b[ p ];
	}

	return a;
}
694894
def modInv(a, m):
    """"""
    # notice that a and m need to co-prime to each other.
    if coPrime([a, m]):
        linearCombination = extendedEuclid(a, m)
        return linearCombination[1] % m
    else:
        return 0
339408
function(q,a,b,x,s,t){
        return __add(__rol(__add(__add(a,q),__add(x,t)),s),b);
    }