123456789101112131415161718192021222324252627282930313233343536373839 |
- ;;; Lispy-Fennel (LF) --- The Functional Fennel Library
- ;;;
- ;;; Copyright (C) 2020 Kevin "The Nuclear" Bloom <nuclearkev@dragora.org>
- ;;;
- ;;; This file is part of LF.
- ;;;
- ;;; LF is free software: you can redistribute it and/or modify
- ;;; it under the terms of the MIT License.
- ;;;
- ;;; LF is distributed in the hope that it will be useful,
- ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ;;; MIT License for more details.
- ;;;
- ;;; You should have received a copy of the MIT License
- ;;; along with LF. If not, see <https://opensource.org/licenses/MIT>.
- (local tbl {})
- (fn tbl.find [val tbl]
- (var x nil)
- (each
- [k v (pairs tbl)]
- (when (= v val)
- (set x {k v})))
- x)
- (fn tbl.empty? [l]
- (not (next l)))
- (fn tbl.merge [t1 t2]
- "Perform a right merge on T1 and T2."
- (var tbl t1)
- (each [k v (pairs t2)]
- (tset tbl k v))
- tbl)
- tbl
|