diff options
| author | Joel Martin <github@martintribe.org> | 2014-12-18 20:33:49 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-09 16:16:50 -0600 |
| commit | b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c (patch) | |
| tree | f4d977ed220e9a3f665cfbf4f68770a81e4c2095 /make/core.mk | |
| parent | aaba249304b184e12e2445ab22d66df1f39a51a5 (diff) | |
| download | mal-b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c.tar.gz mal-b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c.zip | |
All: add keywords.
Also, fix nth and count to match cloure.
Diffstat (limited to 'make/core.mk')
| -rw-r--r-- | make/core.mk | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/make/core.mk b/make/core.mk index dc55ed5..0bb17e6 100644 --- a/make/core.mk +++ b/make/core.mk @@ -32,8 +32,13 @@ false? = $(if $(call _false?,$(1)),$(__true),$(__false)) # Symbol functions +symbol = $(call _symbol,$(call str_decode,$($(1)_value))) symbol? = $(if $(call _symbol?,$(1)),$(__true),$(__false)) +# Keyword functions +keyword = $(call _keyword,$(call str_decode,$($(1)_value))) +keyword? = $(if $(call _keyword?,$(1)),$(__true),$(__false)) + # Number functions number? = $(if $(call _number?,$(1)),$(__true),$(__false)) @@ -98,10 +103,9 @@ assoc = $(word 1,\ dissoc = $(word 1,\ $(foreach hm,$(call _clone_obj,$(word 1,$(1))),\ $(hm) \ - $(foreach key,$(wordlist 2,$(words $(1)),$(1)),\ - $(call _dissoc!,$(hm),$(call str_decode,$($(key)_value)))))) + $(call _dissoc_seq!,$(hm),$(wordlist 2,$(words $(1)),$(1))))) -keys = $(foreach new_list,$(call _list),$(new_list)$(eval $(new_list)_value := $(foreach v,$(call __get_obj_values,$(1)),$(call _string,$(word 4,$(subst _, ,$(v))))))) +keys = $(foreach new_list,$(call _list),$(new_list)$(eval $(new_list)_value := $(foreach v,$(call __get_obj_values,$(1)),$(foreach vval,$(word 4,$(subst _, ,$(v))),$(if $(filter $(__keyword)%,$(vval)),$(call _keyword,$(patsubst $(__keyword)%,%,$(vval))),$(call _string,$(vval))))))) vals = $(foreach new_list,$(call _list),$(new_list)$(eval $(new_list)_value := $(foreach v,$(call __get_obj_values,$(1)),$($(v))))) @@ -127,7 +131,10 @@ cons = $(word 1,$(foreach new_list,$(call _list),$(new_list) $(eval $(new_list)_ concat = $(word 1,$(foreach new_list,$(call _list),$(new_list) $(eval $(new_list)_value := $(strip $(foreach lst,$1,$(call __get_obj_values,$(lst))))))) -nth = $(word $(call gmsl_plus,1,$(call int_decode,$($(word 2,$(1))_value))),$($(word 1,$(1))_value)) +nth = $(strip \ + $(if $(call int_lt,$($(word 2,$(1))_value),$(call int_encode,$(call _count,$(word 1,$(1))))),\ + $(word $(call gmsl_plus,1,$(call int_decode,$($(word 2,$(1))_value))),$($(word 1,$(1))_value)),\ + $(call _error,nth: index out of range))) sfirst = $(word 1,$($(1)_value)) @@ -209,8 +216,10 @@ core_ns = type obj_type \ nil? nil? \ true? true? \ false? false? \ - symbol _symbol \ + symbol symbol \ symbol? symbol? \ + keyword keyword \ + keyword? keyword? \ function? function? \ string? string? \ \ |
