Permalink
Browse files

c++17 add not_fn

	modified:   src/cl-stl-base.lisp
	modified:   src/cl-stl-functional.lisp
	modified:   src/user-package.lisp
  • Loading branch information...
show-matz committed Jan 10, 2019
1 parent 6d7a595 commit 76a21aa9412f1416df9d95326359784af1cb066d
Showing with 48 additions and 0 deletions.
  1. +4 −0 src/cl-stl-base.lisp
  2. +40 −0 src/cl-stl-functional.lisp
  3. +4 −0 src/user-package.lisp
@@ -260,6 +260,10 @@
:mem_fun_ref
:mem_fun1_ref
#-cl-stl-0x98 :mem_fn
#-(or
cl-stl-0x98
cl-stl-0x11
cl-stl-0x14) :not_fn
;+-----------------------------------------+
;| numeric |
;+-----------------------------------------+
@@ -1094,3 +1094,43 @@
(svref arr 4) (svref arr 5)
(svref arr 6) (svref arr 7) (svref arr 8))))
(t (cl:apply fnc (coerce arr 'cl:list))))))))


;;------------------------------------------------------------
;; function not_fn
;;------------------------------------------------------------
#-(or cl-stl-0x98 cl-stl-0x11 cl-stl-0x14)
(define-functor __not_fn (functor)
((op :initform nil
:initarg :operator
:accessor __not_fn-operator)))

;;#-(or cl-stl-0x98 cl-stl-0x11 cl-stl-0x14)
;;(declare-constructor __not_fn (2))
;;
;;#-(or cl-stl-0x98 cl-stl-0x11 cl-stl-0x14)
;;(define-constructor __not_fn (op)
;; (let* ((op (clone op))
;; (fnc (functor_function op)))
;; (make-instance '__not_fn
;; :operator op
;; :closure (lambda (&rest params)
;; (_! (cl:apply fnc params))))))

#-(or cl-stl-0x98 cl-stl-0x11 cl-stl-0x14)
(defun not_fn (functor)
(let* ((op (clone functor))
(fnc (functor_function op)))
(make-instance '__not_fn
:operator op
:closure (lambda (&rest params)
(_! (cl:apply fnc params))))))

#-(or cl-stl-0x98 cl-stl-0x11 cl-stl-0x14)
(defmethod operator_clone ((func __not_fn))
(let* ((op (clone (__not_fn-operator func)))
(fnc (functor_function op)))
(make-instance '__not_fn
:operator op
:closure (lambda (&rest params)
(_! (cl:apply fnc params))))))
@@ -257,6 +257,10 @@
:mem_fun_ref
:mem_fun1_ref
#-cl-stl-0x98 :mem_fn
#-(or
cl-stl-0x98
cl-stl-0x11
cl-stl-0x14) :not_fn
;+-----------------------------------------+
;| numeric |
;+-----------------------------------------+

0 comments on commit 76a21aa

Please sign in to comment.