Closed max-sixty closed 1 year ago
Hi! The problem is that print X[0]
parses as calling the binary operator X
on the operands print
and [0]
, much like 1 .+ [0]
. Generally, mere juxtaposition for calling a function with one operand is finicky. I'll think about how to make the error message better.
That makes sense, thanks
@max-sixty The best way to this is
print! X[0];
! is syntax that's spiritually sort of like what Haskell's $ lets you write. It's as tight as an opening parenthesis on its left, but performs a function call that lets you can omit the closing one up to the next semicolon or so. f! a, b is f(a, b).
I'm not sure whether you're here to answer questions — no worries at all if you're not.
Does this fail because indexing is lower precedence than a function call?
But this seems to work: