Comments (5)
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.
Also =
. It would be nice to be able to write:
(define (all-same? xs) (apply = xs))
from rhombus-prototype.
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.
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.
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)
- Evaluation of subexpressions in `Any.of` HOT 2
- Weird interaction of namespace extension and import HOT 2
- Dark theme hides commented colons HOT 2
- Tracker for potential small additions
- Should multiple-value static infos live under a key? HOT 1
- Is `export` in `meta` supposed to work?
- `super` outside of a class uses wrong syntax object for error
- identifiers with dots in them HOT 4
- Module-path operators confuse Check Syntax
- `values` reducer incorerctly propagates initial-value static info HOT 3
- Improve static error for incorrect arities of subclass constructors HOT 1
- Some use of `Group` leads to “syntax class incompatible with this context”
- Alts after extra-indented blocks
- Not all macro options are allowed in pre-alts block position
- Scope pruning in Rhombus blocks
- arity error in annot.macro implementation HOT 2
- Eager expansion of definitions’ right-hand sides can be detected
- Unquoted matches are not available in the same pattern
- Use-site binder hygiene bug for `let` HOT 7
- A `let` before another `def` in the same block HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rhombus-prototype.