2009/05/20

ついついやってみた SERIES でね

と、はやっているようなのでやってみた。

もちろん SERIES で。ppcre:split を使ったのが負けてる気がするが、そもそも30分くらいかかった時点で。。。

もっと簡単に書けそうな気がするし。。。

(eval-when (:compile-toplevel :load-toplevel :execute)
(require :cl-ppcre)
(require :series)
(use-package :series))

(series::install)

(defun who-can-see (user-names allowed-data report-data)
(choose
(#M(lambda (allowed)
(collect-and
(#M(lambda (reprot)
(collect-or
(#M(lambda (allowed)
(string= reprot allowed))
(scan (ppcre:split " " allowed)))))
report-data)))
allowed-data)
user-names))
#|
(who-can-see #z("userA" "userB" "userC")
#z("data1 data3" "data2 data4" "data3 data5 data6")
#z("data1"))

(who-can-see #z("joe" "nick" "ted")
#z("clients products" "products orders" "clients orders")
#z("clients" "products"))

(who-can-see #z("kathy" "john" "dan" "steve" "cheryl" "tony")
#z("users data" "data orders" "users permissions" "system users controls" "default" "admin users")
#z("users"))

(who-can-see #z("jim" "scott" "barbara")
#z("users order products" "products shipping" "tracking products orders")
#z("admin"))
|#

0 件のコメント: