(*
 * Fix for incorrect implementations of srreadatom and sreadatom1.
 *)

    fun sreadatom1(l, num, str, isnum, isstr) =
        if (snull(l)) orelse (isbreak(shd(l))) then
	    (l, num, str, isnum)
	else
	    let
		val char = shd(l)
		val rest = stl(l)
	    in
		if isdigit(char) then
		    sreadatom1(rest,
			num * 10 + (ord(char) - 48), str ^ char,
			    true andalso (not isstr), isstr)
		else
		    sreadatom1(rest, 0, str ^ char, false, true)
	    end

    fun sreadatom(l) =
	let
	    val (l, num, str, isnum) = sreadatom1(l, 0, "", true, false)
	in
	    if isnum then
		(l, N(num))
	    else
	        if (str = "t") orelse (str = "T") then
		    (l, T)
		else if (str = "nil") orelse (str = "NIL") then
		    (l, NIL)
		else
		    (l, A(str))
	end