From d4ea952032b099a4674c27e964ab6ec421c690f4 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Fri, 26 Apr 2019 23:21:22 +0200 Subject: Dubious way to have lazy orddict updates. I want to keep the benefits of orddict:fetch vs orddict:find, but still be able to re-use the existing code when adding a new element. --- src/ataxic.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ataxic.erl') diff --git a/src/ataxic.erl b/src/ataxic.erl index 195d77f..4d829f3 100644 --- a/src/ataxic.erl +++ b/src/ataxic.erl @@ -126,7 +126,7 @@ -export([apply_to/2, matches/2]). --export([optimize/1]). +-export([optimize/1, is_constant/1]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -378,3 +378,7 @@ matches (OP, Entry) -> true -> true; _ -> false end. + +-spec is_constant (basic()) -> boolean(). +is_constant (#const{}) -> true; +is_constant(_) -> false. -- cgit v1.2.3-70-g09d2