summaryrefslogtreecommitdiff
path: root/macros.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'macros.fnl')
-rw-r--r--macros.fnl17
1 files 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.