rewrite as r7rs library