def str_to_int(string):
    """Solution to exercise R-4.7.

    Describe a recursive function for converting a string of digits into the
    integer it represents. For example, "13531" represents the integer 13,531.
    """
    n = len(string)
    zero_unicode = ord('0')

    def recurse(idx):
        if idx == n:
            return 0  # Base case
        int_val = ord(string[idx]) - zero_unicode
        return int_val * 10 ** (n - 1 - idx) + recurse(idx + 1)

    return recurse(0)