How do I define my own operators in the Io programming language?
- by klep
I'm trying to define my own operator in Io, and I'm having a hard time. I have an object:
MyObject := Object clone do(
lst := list()
!! := method(n, lst at(n))
)
But when I call it, like this:
x := MyObject clone do(lst appendSeq(list(1, 2, 3)))
x !! 2
But I get an exception that argument 0 to at must not be nil. How can I fix?