> > if the Julia syntax was actually x in y, > This is valid syntax:
julia> 1 in [1,2] true I agree that `in(1,[1,2])` feels a little bit weird, but there are two different notions of consistency in competition here - the other being consistency with argument order for all of the other infix operators. See some semi-related discussion at https://github.com/JuliaLang/julia/issues/4498 and others linked from there. On Sun, Jan 11, 2015 at 4:34 PM, Michael Landis <[email protected]> wrote: > if the Julia syntax was actually x in y, I'd have less of an objection, > but while it looks like a function call, the message receiver should be the > first argument. > > > On Sunday, January 11, 2015 at 1:10:28 PM UTC-8, Jake Bolewski wrote: >> >> `in` is most often used with infix notation (ex. 1 in [1,2,3])? >> >> On Sunday, January 11, 2015 at 4:00:37 PM UTC-5, Michael Landis wrote: >>> >>> Most Julia built-ins are defined so that the first argument is the >>> (Smalltalk style) message receiver, but in(x,y) reverses the apparent >>> standard, testing whether x is in y (the message receiver). >>> >>> append(x,y) appends y to x (the message receiver); >>> push(x,y) pushes y onto x (the message receiver); >>> in(x,y) should test whether y is in x, not the reverse. >>> >>> IMO, defeating orthogonality is a mistake. What's the justification for >>> 'in()' violating the usual message receiver semantics? >>> >>
