diff --git a/lib/auth/web.lisp b/lib/auth/web.lisp index a5ca2a9..57f3281 100644 --- a/lib/auth/web.lisp +++ b/lib/auth/web.lisp @@ -21,7 +21,6 @@ (defun login-form (ctx msg-in) (let ((msg (message:create '(:auth :form :login) :data (list - ;:fields (:login :password) :fields (login-fields) :button "Login")))) (actor:send (actor:customer msg-in) msg) diff --git a/test/test-core.lisp b/test/test-core.lisp index 87c587d..4472f4f 100644 --- a/test/test-core.lisp +++ b/test/test-core.lisp @@ -72,6 +72,8 @@ (t:show-result)))) (deftest test-util () + (let ((35+ (util:curry #'+ 35))) + (== (funcall 35+ 7) 42)) (let ((now (get-universal-time))) (== (util:from-unix-time (util:to-unix-time now)) now)) (let* ((x (util:ptr)) diff --git a/util/async.lisp b/util/async.lisp index ea552f2..a531cb1 100644 --- a/util/async.lisp +++ b/util/async.lisp @@ -17,14 +17,15 @@ (defun init () (when (null lp:*kernel*) - (format t "async:init ~a ~%" - (setf lp:*kernel* (lp:make-kernel (serapeum:count-cpus)))))) + ;(format t "async:init ~a ~%" + (setf lp:*kernel* (lp:make-kernel (serapeum:count-cpus))) + (util:lgi lp:*kernel*))) (defun finish () (when lp:*kernel* (lp:end-kernel))) -;;;; simple task = mailbox with result channel +;;;; simple addressable task = mailbox with result channel (defclass mailbox () ((queue :reader queue :initform (lpq:make-queue)) @@ -54,7 +55,7 @@ (defun try-receive-result (mb) (lp:try-receive-result (channel mb))) -;;;; tasks - with behavior and thread-safe status +;;;; real (restartable) task - with behavior and thread-safe status (defclass task (mailbox) ((behavior :accessor behavior :initarg :behavior))) diff --git a/util/util.lisp b/util/util.lisp index af6cb31..aca0a0a 100644 --- a/util/util.lisp +++ b/util/util.lisp @@ -4,7 +4,8 @@ (:use :common-lisp) (:local-nicknames (:b64 :qbase64)) #+sbcl (:import-from :sb-ext #:add-package-local-nickname) - (:export #:make-vars-format #:lg #:lgd #:lgi #:lgw #:lgx + (:export #:curry + #:make-vars-format #:lg #:lgd #:lgi #:lgw #:lgx #:from-unix-time #:to-unix-time #:ptr #:rfill #:rtrim @@ -19,6 +20,11 @@ (in-package :scopes/util) +;;;; functional tools + +(defun curry (fn a) + (lambda (&rest args) (apply fn a args))) + ;;;; formatting and logging shortcuts (defun make-vars-format (vars &optional info)