mirror of
https://github.com/janet-lang/janet
synced 2024-11-24 17:27:18 +00:00
Add from-pairs
to core. #683
This always creates a table, use `table/to-struct` to create a struct.
This commit is contained in:
parent
e181ee586b
commit
8fc8974b60
@ -1,6 +1,9 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## ??? - Unreleased
|
||||
- Add `from-pairs` to core.
|
||||
|
||||
## 1.15.5 - 2021-04-25
|
||||
- Add `declare-headers` to jpm.
|
||||
- Fix error using unix pipes on BSDs.
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
project('janet', 'c',
|
||||
default_options : ['c_std=c99', 'build.c_std=c99', 'b_lundef=false', 'default_library=both'],
|
||||
version : '1.15.5')
|
||||
version : '1.15.6')
|
||||
|
||||
# Global settings
|
||||
janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet')
|
||||
|
@ -1525,6 +1525,15 @@
|
||||
(loop [k :keys dict] (array/push ret k (in dict k)))
|
||||
ret)
|
||||
|
||||
(defn from-pairs
|
||||
``Takes a sequence of pairs and creates a table from each pair. The inverse of
|
||||
`pairs` on a table.``
|
||||
[ps]
|
||||
(def ret @{})
|
||||
(each [k v] ps
|
||||
(put ret k v))
|
||||
ret)
|
||||
|
||||
(defn interpose
|
||||
`Returns a sequence of the elements of ind separated by
|
||||
sep. Returns a new array.`
|
||||
|
@ -5,9 +5,9 @@
|
||||
|
||||
#define JANET_VERSION_MAJOR 1
|
||||
#define JANET_VERSION_MINOR 15
|
||||
#define JANET_VERSION_PATCH 5
|
||||
#define JANET_VERSION_EXTRA ""
|
||||
#define JANET_VERSION "1.15.5"
|
||||
#define JANET_VERSION_PATCH 6
|
||||
#define JANET_VERSION_EXTRA "-dev"
|
||||
#define JANET_VERSION "1.15.6-dev"
|
||||
|
||||
/* #define JANET_BUILD "local" */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user