From d58a0d80488648ee6daa9ca7df1a79cd657cf8bc Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Tue, 26 Jan 2021 02:28:32 +0300 Subject: fix: remove duplicate multisym->sym function --- macros.fnl | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/macros.fnl b/macros.fnl index d53e54b..3f5eb5f 100644 --- a/macros.fnl +++ b/macros.fnl @@ -11,16 +11,17 @@ (fn multisym->sym [s] ;; Strip multisym part from symbol and return new symbol and - ;; indication that sym was transformed. Non-multisym symbols returned as - ;; is. + ;; indication that sym was transformed. Non-multisym symbols + ;; returned as is. ;; ;; ``` fennel ;; (multisym->sym a.b) ;; => (a true) ;; (multisym->sym a.b.c) ;; => (c true) ;; (multisym->sym a) ;; => (a false) ;; ``` - (values (sym (string.match (tostring s) "[^.]+$")) - (multi-sym? s))) + (if (multi-sym? s) + (values (sym (string.gsub (tostring s) ".*%." "")) true) + (values s false))) (fn contains? [tbl x] ;; Checks if `x` is stored in `tbl` in linear time. @@ -261,14 +262,6 @@ returns the value without additional metadata. _ (deep-tostring v))))) arglist))) -(fn multisym->sym [s] - ;; Strips away the multisym part from symbol, and return just the - ;; symbol itself. Also returns the second value of whether the - ;; transformation occured or not. - (if (multi-sym? s) - (values (sym (string.gsub (tostring s) ".*[.]" "")) true) - (values s false))) - (fn has-amp? [args] ;; Check if arglist has `&` and return its position of `false`. Performs ;; additional checks for `&` and `...` usage in arglist. -- cgit v1.2.3