From 676b0ef8d0b2f5b68193f3a893039f5a67c4fb6e Mon Sep 17 00:00:00 2001 From: Paul Lang Date: Sun, 16 Jul 2023 22:02:39 +0000 Subject: [PATCH 1/2] allow 2-argument piecewise; use Base.ifelse --- Project.toml | 2 -- src/SBML.jl | 1 - src/interpret.jl | 4 ++-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index 581ec26..64021c2 100644 --- a/Project.toml +++ b/Project.toml @@ -5,7 +5,6 @@ version = "1.4.4" [deps] DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" SBML_jll = "bb12108a-f4ef-5f88-8ef3-0b33ff7017f1" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" @@ -14,7 +13,6 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] ConstructionBase = "1.3" DocStringExtensions = "0.8, 0.9" -IfElse = "0.1" SBML_jll = "5.19.5" Symbolics = "3, 4" Unitful = "1" diff --git a/src/SBML.jl b/src/SBML.jl index bd4bc5f..3a5eb88 100644 --- a/src/SBML.jl +++ b/src/SBML.jl @@ -6,7 +6,6 @@ module SBML using SBML_jll, Libdl using DocStringExtensions -using IfElse using SparseArrays using Unitful diff --git a/src/interpret.jl b/src/interpret.jl index e31438e..b25e6fe 100644 --- a/src/interpret.jl +++ b/src/interpret.jl @@ -5,9 +5,9 @@ function sbmlPiecewise(args...) if length(args) == 1 args[1] elseif length(args) >= 3 - IfElse.ifelse(args[2], args[1], sbmlPiecewise(args[3:end]...)) + ifelse(args[2], args[1], sbmlPiecewise(args[3:end]...)) else - throw(DomainError(args, "malformed piecewise SBML function")) + ifelse(args[2], args[1], NaN) end end From 40dba782b5fb9c02a3da0558fb1e5f597e934c92 Mon Sep 17 00:00:00 2001 From: Paul Lang <47160416+paulflang@users.noreply.github.com> Date: Mon, 17 Jul 2023 14:10:26 +0200 Subject: [PATCH 2/2] remove IfElse --- src/interpret.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interpret.jl b/src/interpret.jl index b25e6fe..d506187 100644 --- a/src/interpret.jl +++ b/src/interpret.jl @@ -14,7 +14,7 @@ end sbmlNeq(a, b) = !isequal(a, b) function sbmlRelational(op) _iter(x, y) = op(x, y) - _iter(x, y, args...) = IfElse.ifelse(op(x, y), _iter(y, args...), op(x, y)) + _iter(x, y, args...) = ifelse(op(x, y), _iter(y, args...), op(x, y)) _iter end