<commit_before>/**
 * @fileOverview Meta hosted function object.
 */
define(['exports',
        'atum/compute',
        'atum/builtin/object',
        'atum/builtin/meta/base',
        'atum/operations/error',
        'atum/operations/func',
        'atum/operations/object',
        'atum/operations/value_reference',
        'atum/value/value'],
function(exports,
        compute,
        builtin_object,
        meta_base,
        error,
        func,
        object_operations,
        value_reference,
        value){
"use strict";

/* Function
 ******************************************************************************/
/**
 * Hosted function meta object.
 */
var Function = function(proto, props) {
    meta_base.Base.call(this, proto, props);
};
Function.prototype = new meta_base.Base;
Function.prototype.constructor = Function;

Function.prototype.cls = "Function";

/**
 * Construct computation.
 */
Function.prototype.construct = function(self, args) {
    return compute.bind(
        value_reference.dereferenceFrom(
            object_operations.get(self, 'prototype'),
            function(proto, protoRef) {
                return object_operations.create(value.isObject(proto) ?
                    protoRef :
                    builtin_object.ObjectPrototype);
            }),
        function(t) {
            return value_reference.dereferenceFrom(
                func.apply(self, t, args),
                function(result, resultRef) {
                    return compute.just(value.isObject(result) ? resultRef : t);
                });
        });
};

/**
 * Is computation `v` an instance of function `ref`.
 */
Function.prototype.hasInstance = (function(){
    var loop = function(v, o) {
        if (!v.proto)
            return compute.no;
        return compute.bind(
            value_reference.getFrom(compute.just(v.proto)),
            function(v) {
                return (v === o ?
                    compute.yes :
                    loop(v, o));
            });
    };
    
    return function(ref, v) {
        return compute.bind(
            value_reference.getFrom(compute.just(v)),
            function(v) {
                if (!value.isObject(v))
                    return compute.no;
                return compute.bind(
                    value_reference.getFrom(object_operations.get(ref, 'prototype')),
                    function(o) {
                        if (!value.isObject(o))
                            return error.typeError();
                        return loop(v, o);
                    });
            });
    };
}());

/* Export
 ******************************************************************************/
exports.Function = Function;

});<commit_msg>Cleaned up meta func instanceOf a bit<commit_after>/**
 * @fileOverview Meta hosted function object.
 */
define(['exports',
        'atum/compute',
        'atum/builtin/object',
        'atum/builtin/meta/base',
        'atum/operations/error',
        'atum/operations/func',
        'atum/operations/object',
        'atum/operations/value_reference',
        'atum/value/value'],
function(exports,
        compute,
        builtin_object,
        meta_base,
        error,
        func,
        object_operations,
        value_reference,
        value){
"use strict";

/* Function
 ******************************************************************************/
/**
 * Hosted function meta object.
 */
var Function = function(proto, props) {
    meta_base.Base.call(this, proto, props);
};
Function.prototype = new meta_base.Base;
Function.prototype.constructor = Function;

Function.prototype.cls = "Function";

/**
 * Construct computation.
 */
Function.prototype.construct = function(self, args) {
    return compute.bind(
        value_reference.dereferenceFrom(
            object_operations.get(self, 'prototype'),
            function(proto, protoRef) {
                return object_operations.create(value.isObject(proto) ?
                    protoRef :
                    builtin_object.ObjectPrototype);
            }),
        function(t) {
            return value_reference.dereferenceFrom(
                func.apply(self, t, args),
                function(result, resultRef) {
                    return compute.just(value.isObject(result) ? resultRef : t);
                });
        });
};

/**
 * Is computation `v` an instance of function `ref`.
 */
Function.prototype.hasInstance = (function(){
    var loop = function(v, o) {
        if (!v.proto)
            return compute.no;
        return value_reference.dereference(v.proto, function(v) {
            return (v === o ? compute.yes : loop(v, o));
        });
    };
    
    return function(ref, v) {
        return value_reference.dereference(v, function(v) {
            if (!value.isObject(v))
                return compute.no;
            return value_reference.dereferenceFrom(
                object_operations.get(ref, 'prototype'),
                function(o) {
                    if (!value.isObject(o))
                        return error.typeError();
                    return loop(v, o);
                });
        });
    };
}());

/* Export
 ******************************************************************************/
exports.Function = Function;

});
{'fraction_non_alphanumeric': 0.1760590015128593, 'fraction_numerical': 0.0, 'mean_word_length': 1.9285714285714286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3592071', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1321, 'n_words': 258}