orangeduck / BuildYourOwnLisp

Learn C and build your own programming language in under 1000 lines of code!
http://www.buildyourownlisp.com/
Other
2.93k stars 396 forks source link

Arity of operators #100

Closed ajaymonga closed 8 years ago

ajaymonga commented 8 years ago

Last example in ch 7 [- (* 10 10) (+ 1 1 1)] should be malformed as it supplies 3 arguments to binary + operator. Current Grammar does not enforce the arity. Is this intentional?

orangeduck commented 8 years ago

Yes this is intentional. If you supply three or more numbers to any of the operators it will apply that operator to all three. This is also the same in many other lisps. Thanks.