yaltik_odoo_custom/hy_odoo/utils.hy

25 lines
570 B
Hy

;; Copyright 2021-2022 Fabien Bourgeois <fabien@yaltik.com>
;;
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at https://mozilla.org/MPL/2.0/.
" Hy General Utils "
(require hyrule.collections [assoc])
(defn pick [keys record]
(reduce
(fn [acc key]
(do
(assoc acc key (get record key))
(return acc)))
keys
{}))
(defn pick-values [keys record]
(list
(map
(fn [key] (get record key))
keys)))