~tim/lisp200

c0885998702d72d5280b2c276614576ade9b5476 — Tim Morgan 8 months ago 922ef34
Formatting
1 files changed, 4 insertions(+), 8 deletions(-)

M lisp.rb
M lisp.rb => lisp.rb +4 -8
@@ 146,14 146,10 @@ ALT_NAMES = { '=' => 'eq', '*' => 'mul', '/' => 'div', '+' => 'add', '-' => 'sub
def safe_name(name)
  ALT_NAMES[name.to_s] || name.to_s.chars.map do |c|
    case c
    when SAFE_CHARS
      c
    when '-'
      '_'
    when '?'
      '_q'
    else
      "_#{c.ord}"
    when SAFE_CHARS then c
    when '-' then '_'
    when '?' then '_q'
    else "_#{c.ord}"
    end
  end.join
end