Giter Club home page Giter Club logo

Comments (5)

rmculpepper avatar rmculpepper commented on May 24, 2024 3

Adding a 0-argument case wouldn't increase the conflict, given that that they already take 1 or more. There ought to be a non-infix way to use operators like <, +, etc.

from rhombus-prototype.

sorawee avatar sorawee commented on May 24, 2024 1

Also =. It would be nice to be able to write:

(define (all-same? xs) (apply = xs))

from rhombus-prototype.

jackfirth avatar jackfirth commented on May 24, 2024

This would definitely conflict with pushing racket2 in the infix direction, where these functions would likely become binary infix operators instead of variable-arity functions.

from rhombus-prototype.

jackfirth avatar jackfirth commented on May 24, 2024

Should the variable-arity way use the same names? I personally don't think so, because (to non-racketeers) the symbols are so strongly associated with their infix notation. And that way I wouldn't have to deal with the confusion of reading prefix < / >, which consistently trips me up and causes bugs when I pick the wrong one or put the arguments in the wrong order.

from rhombus-prototype.

rocketnia avatar rocketnia commented on May 24, 2024

For one order I was choosing names for recently, I tried the naming convention [type]-descends? and [type]-ancestor/c instead of [type]<? and [type]</c, and I've been finding it just as confusing. I think this is largely just another poor choice of name: Ancestors come before their descendants chronologically, and the set of values that satisfies [type]-ancestor/c increases in size as the argument is changed to a descendant of itself, but the legacy of object-oriented inheritance hierarchies makes it really tempting to think of a descendant as a subset of its ancestor instead, and this combination of connotations kept messing me up.

For the ordering of real numbers, I usually put my expressions in the order of the number line, so I almost always prefer < or <= rather than > or >= no matter what language I'm in. That makes it fairly easy to read < and <= expressions even in prefix notation, because the only attention I even pay to the operator is to make sure it's pointing the way I expect. :-p

Nevertheless, I do internally pronounce (< 3 x) the same way as (less-than-three? x), which of course has the opposite meaning, and it can be confusing.

So orderings are one place I would find it much more readable to have expressions like (compares? 0 <= i < j < n) and perhaps (compares/c 0 <= _ < n). To make them extra confusion-resistant, perhaps <= and < shouldn't even be functions, just a special type of value (or syntax) that can be passed to these compares? and compares/c operations.

I think I've heard of people implementing this compares? operation before a few times, but if there's one that's common for Racket programmers, I don't know quite what name to look it up by.

from rhombus-prototype.

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.