erlang: implementing 'read' op-code