diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-17 21:49:07 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-17 21:49:07 -0500 |
| commit | db4c329aff4621e05b92a55be4f18173f5a4f655 (patch) | |
| tree | 92baaa6d88246e509cfd6a7d03d8fab997e0b935 /bash/core.sh | |
| parent | 8cb5cda46cf3aef847ae3926dc53a5e5f87fe261 (diff) | |
| download | mal-db4c329aff4621e05b92a55be4f18173f5a4f655.tar.gz mal-db4c329aff4621e05b92a55be4f18173f5a4f655.zip | |
All: perf test, Makefile refactor, add *host-language*
Other:
- bash,make,postscript: quasiquote of vectors
- Fix Java slurp
- add time function to core.mal
- switches on *host-language* for make time-secs vs time-ms
- Ignore */experiments directories
Diffstat (limited to 'bash/core.sh')
| -rw-r--r-- | bash/core.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bash/core.sh b/bash/core.sh index e0cba38..c8a0261 100644 --- a/bash/core.sh +++ b/bash/core.sh @@ -56,6 +56,12 @@ num_gte () { r=$(( ${ANON["${1}"]} >= ${ANON["${2}"]} )); _num_bool "${r}"; num_lt () { r=$(( ${ANON["${1}"]} < ${ANON["${2}"]} )); _num_bool "${r}"; } num_lte () { r=$(( ${ANON["${1}"]} <= ${ANON["${2}"]} )); _num_bool "${r}"; } +# return number of milliseconds since epoch +time_ms () { + local ms=$(date +%s%3N) + _number "${ms}" +} + # String functions @@ -280,7 +286,7 @@ meta () { } -# atoms +# Atom functions atom? () { _atom? "${1}" && r="${__true}" || r="${__false}"; } deref () { @@ -327,6 +333,7 @@ declare -A core_ns=( [-]=num_minus [__STAR__]=num_multiply [/]=num_divide + [time-ms]=time_ms [list]=_list [list?]=list? |
