我尝试实现一个基于Hunchentoot的简单帖子示例.
这是代码:
(define-easy-handler (test :uri "/test") ()
(with-html-output-to-string (*standard-output* nil :prologue t :indent t)
(:html
(:body
(:h1 "Test")
(:form :action "/test2" :method "post" :id "addform"
(:input :type "text" :name "name" :class "txt")
(:input :type "submit" :class "btn" :value "Submit"))))))
(define-easy-handler (test2 :uri "/test2") (name)
(with-html-output-to-string (*standard-output* nil :prologue t :indent t)
(:html
(:body
(:h1 name)))))
Run Code Online (Sandbox Code Playgroud)
我可以正确连接到http://127.0.0.1:8080/test并查看文本输入表单.但是当我提交文本时,我得到一个空白页面,我希望在文本输入中给出一个带有标题的页面.
不确定有什么问题,有人可以建议吗?
我有以下列表:
(1 (2))
Run Code Online (Sandbox Code Playgroud)
我想用(2(3))替换(2)以获得:
(1 (2 (3)))
Run Code Online (Sandbox Code Playgroud)
如下使用subst不会返回所希望的结果:
(subst '(2 (3)) '(2) '(1 (2)))
Run Code Online (Sandbox Code Playgroud)
有没有简单的方法来执行替换?
是否可以使用列表作为参数调用make-array函数?例如:
(make-array '((length '("a" "b")) (length '("r" "8" "5"))))
Run Code Online (Sandbox Code Playgroud)
返回:
#<TYPE-ERROR expected-type: NUMBER datum: (LENGTH '(...
Run Code Online (Sandbox Code Playgroud)
即使我尝试使用以下命令转换长度的结果:
(coerce (length '(1)) 'number)
Run Code Online (Sandbox Code Playgroud)
它适用于一维数组但不适用于二维数组.