shriram / smol

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

`set-left` and `set-right` should check their args, or shouldn't? #6

Closed LuKuangChen closed 3 years ago

LuKuangChen commented 3 years ago

Doc and implementation mismatch.

The smol/state writes

(set-left! expr val) → Void
expr : Pair
val : Any

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

> (defvar v (mvec 1 2 3))
> (set-left! v 4)
> v
'#(4 2 3)
> (set-right! v 5)
> v
'#(4 5 3)
> 
LuKuangChen commented 3 years ago

These two functions should check their arguments.