Yeah, I forget exactly why you can't to that with & but there's some parsing ambiguity.
On Mon, Aug 18, 2014 at 6:33 PM, ggggg <[email protected]> wrote: > Ok, thanks. Although it doesn't seem to be the case for |, eg "|(true, > false)" works out of the box. > > > On Monday, August 18, 2014 4:24:31 PM UTC-6, Stefan Karpinski wrote: > >> This are some of those few operators that need parens to be used in >> function call syntax: >> >> julia> (&)(3,5) >> 1 >> >> julia> (|)(3,5) >> 7 >> >> >> This isn't required in unambiguous situations like as an argument to >> another function: >> >> julia> reduce(|, 0:8) >> 15 >> >> >> >> >> On Mon, Aug 18, 2014 at 6:20 PM, ggggg <[email protected]> wrote: >> >>> Is there a named function that does what & does, eg "&(a,b) == a&b"? I >>> actually want a multi argument version like "$(a,b,c...)". Also is that >>> the name of that function is not "&" and "& is not overloadable? The same >>> is not true of "|". >>> >>> *julia> **a = zeros(Bool,10);b=[randbool() for j=1:10];* >>> >>> *julia> **a&b==b* >>> >>> *false* >>> >>> *julia> **a|b==b* >>> >>> *true* >>> >>> *julia> **|(a,b)==b* >>> >>> *true* >>> >>> *julia> **&(a,b)==b* >>> >>> >>> *ERROR: unsupported or misplaced expression & * >>> *julia> **&(a,b) = a&b* >>> >>> *ERROR: syntax: invalid assignment location* >>> >>> Julia even seems to think & is a function >>> >>> *julia> **&* >>> >>> *& (generic function with 35 methods)* >>> >>> >>> >>
