-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.qx
38 lines (30 loc) · 795 Bytes
/
test.qx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(defun! append (el to)
(concat to (list el)))
;;; partially applies some arguments to a function
(defmacro! part (fun &args)
`(fn* (it) (,fun ~args)))
(val! ret 0)
;; (defmacro! apply (&args)
;; (let* (last ((count args) \- 1))
;; (do
;; `(,(car args) ; first function
;; ~(slice 1 last args) ; rest of the arguments
;; ~(nth last args))))) ; arguments provided in a list
;; (defun! __do-filter (pred list acc)
;; (if (nil? list)
;; acc
;; (__do-filter
;; pred
;; (cdr list)
;; (if (pred (car list))
;; (cons (car list) acc)
;; acc))))
;; (defun! filter (pred list)
;; (__do-filter pred list '()))
;; (defun! count_atoms (sym in)
;; (filter (part = sym)
;; (filter
;; sym?
;; (dbg in))))
(export! '(ret part append))
0