Giter Site home page Giter Site logo

Comments (5)

michaelhkay avatar michaelhkay commented on July 18, 2024

Currently 4.6.2.3 Partial Function Application says that the name property of the returned function is absent, both for static and dynamic partial application. Are you proposing this should be changed for both cases (static and dynamic)?

The only objection I can see is that someone might assume that if a function item has name=fn:concat and arity=2 then they can assume that the function in question is concat#2, whereas under your proposal it might, for example, be concat(?, '-', ?). It feels a little confusing to me that you can have two function items with the same name and arity that do different things.

from qtspecs.

ChristianGruen avatar ChristianGruen commented on July 18, 2024

The only objection I can see is that someone might assume that if a function item has name=fn:concat and arity=2 then they can assume that the function in question is concat#2, whereas under your proposal it might, for example, be concat(?, '-', ?).

My proposal would be to preserve the function name if the result of the partial application is identical to what a named function reference returns, which is only the case for what I tried to describe as “partially applied functions without applications”, i.e., if all arguments are placeholders. In other cases, the reference to the function name must be dropped, as the resulting function item is not equivalent to the built-in function anymore.

In contrast, function-arity should always return the number of required arguments of a function item, i.e., it should return 1 for count#1, count(?), concat(?, '-'), fn($x) {}, and fn {}.

from qtspecs.

dnovatchev avatar dnovatchev commented on July 18, 2024

I think we must revise the definition of "partial application" and state that f(?, ?, ...?) (all arguments substituted by ?) is not a partial application - because there is nothing "partial" in this expression - in fact it is total freedom.

Probably any such total-freedom expression must be flagged as an error. Anyway, I pity the reader who would need to count the question marks...

from qtspecs.

dnovatchev avatar dnovatchev commented on July 18, 2024

My proposal would be to preserve the function name if the result of the partial application is identical to what a named function reference returns, which is only the case for what I tried to describe as “partially applied functions without applications”, i.e., if all arguments are placeholders. In other cases, the reference to the function name must be dropped, as the resulting function item is not equivalent to the built-in function anymore.

The number of actual expressions containing "“partially applied functions without applications”, i.e., if all arguments are placeholders." is likely indiscriminately close to 0.

Therefore, this new "feature" seems to be the solution to a non-existent problem.

from qtspecs.

ChristianGruen avatar ChristianGruen commented on July 18, 2024

The number of actual expressions containing "“partially applied functions without applications”, i.e., if all arguments are placeholders." is likely indiscriminately close to 0.

Nope; I’ve encountered this repeatedly in practice. Some people prefer to write sum(?) instead of sum#1.

from qtspecs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.