Julia: Add !=(2) to parallel ==(2)

Created on 1 Nov 2018  路  4Comments  路  Source: JuliaLang/julia

The ==(2) method is a convenient replacement of x->x==2. Could we also have !=(2)?

EDIT: isa(Vector) and ===(2) would be nice, too.

Most helpful comment

The convention we decided on is that we do this kind of "auto-currying" for

predicate(subject, object)

functions taking two arguments and the curried form is

subject -> predicate(subject, object)

So in(collection) means

item -> item in collection

By that rule <(b) means a -> a < b which makes sense since you read it as "less than b".

All 4 comments

I suppose that we cannot define this for the other types of comparisons like >= or <= right?

Sure we can. It just gets a bit confusing, since in <(2) it might not be clear whether the 2 is the left or right argument.

The convention we decided on is that we do this kind of "auto-currying" for

predicate(subject, object)

functions taking two arguments and the curried form is

subject -> predicate(subject, object)

So in(collection) means

item -> item in collection

By that rule <(b) means a -> a < b which makes sense since you read it as "less than b".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tkoolen picture tkoolen  路  3Comments

wilburtownsend picture wilburtownsend  路  3Comments

omus picture omus  路  3Comments

TotalVerb picture TotalVerb  路  3Comments

iamed2 picture iamed2  路  3Comments