src/rlisp.rb
##########################################
# Extracting variables used
##########################################
# * defs - variables defined inside current function
# * uses - variables used
# * nest - variables used in nested scopes
# * mods - variables modified after use
#        (let/set! - modified, even if there's just one)
Extracting variables used
defs - variables defined inside current function
uses - variables used
nest - variables used in nested scopes
mods - variables modified after use
(let/set. - modified, even if there's just one)
Extracting variables used defs - variables defined inside current function uses - variables used nest - variables used in nested scopes mods - variables modified after use ( let / set . - modified even if there ' s just one )
def extract_variables_used_fn(expr)
    defs, uses, nest, mods = {}, {}, {}, {}
    n_args, rest_arg, proc_arg = parse_args(expr[1])
    n_args.each{|a| defs[a] = true}
    defs[rest_arg] = true if rest_arg
    defs[proc_arg] = true if proc_arg
    expr[2..-1].each{|e| extract_variables_used_expr(e, defs, uses, nest, mods)}
    return [defs.keys, uses.keys, nest.keys, mods.keys]
  end
def extract_variables_used_fn ( expr ) defs , uses , nest , mods = { } , { } , { } , { } n_args , rest_arg , proc_arg = parse_args ( expr [ 1 ] ) n_args . each { | a | defs [ a ] = true } defs [ rest_arg ] = true if rest_arg defs [ proc_arg ] = true if proc_arg expr [ 2 .. - 1 ] . each { | e | extract_variables_used_expr ( e , defs , uses , nest , mods ) } return [ defs . keys , uses . keys , nest . keys , mods . keys ] end
Extracting variables used
 defs - variables defined inside current function
 uses - variables used
 nest - variables used in nested scopes
 mods - variables modified after use
(let/set!
Extracting variables used defs - variables defined inside current function uses - variables used nest - variables used in nested scopes mods - variables modified after use ( let / set!
expr
<not_specific>