shriram / smol

The SMoL (Standard Model of Languages) Family of Languages
15 stars 3 forks source link

`left` and `right` should check their args, or shouldn't? #4

Closed LuKuangChen closed 3 years ago

LuKuangChen commented 3 years ago

Doc and implementation mismatch.

The smol/fun doc is clear that "pair is a special-case [two-element] of ivec", and writes

(left expr) → Any
expr : Pair

However, the implementation of left and right do not enforce this specification (expr : Pair):

> (left (ivec 0))
0
> (right (ivec 0 1 2))
1
> 
LuKuangChen commented 3 years ago

These two functions should check their arguments.