diff options
| author | Andrey Orst <andreyorst@gmail.com> | 2021-01-26 02:28:32 +0300 |
|---|---|---|
| committer | Andrey Orst <andreyorst@gmail.com> | 2021-01-26 02:28:32 +0300 |
| commit | d58a0d80488648ee6daa9ca7df1a79cd657cf8bc (patch) | |
| tree | fa6c6166f9350b5f8fd94803ea035e59343ca8bc /macros.fnl | |
| parent | 79291f0e4f9c7c4f0a8ebcbe53270c65ad932bfc (diff) | |
fix: remove duplicate multisym->sym function
Diffstat (limited to 'macros.fnl')
| -rw-r--r-- | macros.fnl | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -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. |