From fcd6f8d6d4cf93a5c74b18ba33098dc8473323e9 Mon Sep 17 00:00:00 2001 From: Eric Proffitt Date: Thu, 28 May 2020 18:29:39 -0400 Subject: [PATCH] up --- .DS_Store | Bin 10244 -> 10244 bytes src/macros.jl | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.DS_Store b/.DS_Store index a193c84d74d83f1b8eef92f73bf8e1f23fddfc11..ec01c8a6b02bab229ed5e16def31e5adb691aa80 100644 GIT binary patch delta 24 fcmZn(XbIS`T7=!$NJqig$Yip-pyTGxB7(vIVsr;f delta 16 XcmZn(XbIS`T4b_>pvUIVB7(vIIClm5 diff --git a/src/macros.jl b/src/macros.jl index b495c15..f58b3ff 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -9,7 +9,7 @@ macro juliadots(str::String) print(Crayon(foreground=:white, bold=true), $str); ) - return expr_out + return esc(expr_out) end macro juliadots(expr::Expr) @@ -20,46 +20,46 @@ macro juliadots(expr::Expr) print(Crayon(foreground=:red, bold=true), " ●"); print(Crayon(foreground=:green, bold=true), "●"); print(Crayon(foreground=:blue, bold=true), "● "); - print(Crayon(foreground=:white, bold=true), :($($expr))) + print(Crayon(foreground=:white, bold=true), $expr) ) - return expr_out + return esc(expr_out) end macro boink(expr::Expr) "Add EPSILON to a numerical variable or array." - expr_out = :(:($($expr)) .+ EPSILON) - return expr_out + expr_out = :($expr .+ EPSILON) + return esc(expr_out) end macro positive(expr::Expr) "Add EPSILON to a numerical variable or array during variable assignment." if (expr.head == :.) || (expr.head == :ref) - expr_out = :(:($($expr)) .+= EPSILON) + expr_out = :($expr .+= EPSILON) elseif expr.head == :(=) - expr_out = :(:($($(expr.args[1]))) = EPSILON .+ :($($(expr.args[2])))) + expr_out = :($(expr.args[1]) = EPSILON .+ $(expr.args[2])) end - return expr_out + return esc(expr_out) end macro finite(expr::Expr) "Prevent overflow of floating point to Inf by returning floatmax() of value." if (expr.head == :.) || (expr.head == :ref) - expr_out = :(:($($expr)) = sign.(:($($expr))) .* min.(abs.(:($($expr))), floatmax.(:($($expr))))) + expr_out = :($expr = sign.($expr) .* min.(abs.($expr), floatmax.($expr))) elseif expr.head == :(=) - expr_out = :(:($($(expr.args[1]))) = sign.(:($($(expr.args[2])))) .* min.(abs.(:($($(expr.args[2])))), floatmax.(:($($(expr.args[2])))))) + expr_out = :($(expr.args[1]) = sign.($(expr.args[2])) .* min.(abs.($(expr.args[2])), floatmax.($(expr.args[2])))) elseif expr.head == :(-=) - expr_out = :(:($($(expr.args[1]))) = sign.(:($($(expr.args[1])))) .* min.(abs.(:($($(expr.args[1]))) - :($($(expr.args[2])))), floatmax.(:($($(expr.args[1]))) - :($($(expr.args[2])))))) + expr_out = :($(expr.args[1]) = sign.($(expr.args[1])) .* min.(abs.($(expr.args[1]) - $(expr.args[2])), floatmax.($(expr.args[1]) - $(expr.args[2])))) end - return expr_out + return esc(expr_out) end macro buffer(expr::Expr)