Hacker News new | ask | show | jobs
by runarberg 4398 days ago
Julia

  !(a::Int) = !bool(a)
  !0 + 2 + 2

  ##> 5
1 comments

Or more directly:

  julia> +(a::Int, b::Int) = if a==b==2 5 else a-(-b) end
  julia> 2+2
  5
  julia> 3+1
  4
(The else part can't use + or it will cause infinite recursion).