Common Lisp是否为使用deftype创建的未定义类型提供了便利 ?
我没有在Hyperspec中找到任何关于它的内容.
我正在尝试从我的elisp代码发送HTTP GET请求,并将响应的内容存储在变量中.很简单
use LWP::Simple;
my $data = get("http://some.url");
Run Code Online (Sandbox Code Playgroud)
我使用Windows 7和Emacs 24.2.
我尝试使用Emacs-Web包.这里基本上是文档中的一个例子,简化了更多:
(web-http-get
(lambda (httpc header my-data)
(message my-data))
:url "http://breqwas.net/test.txt"))
Run Code Online (Sandbox Code Playgroud)
这不起作用,我在迷你缓冲区得到这个回应:
Keyword argument http://breqwas.net/emacs.txt not one of (:host :port :extra-headers :mode :logging)
Run Code Online (Sandbox Code Playgroud)
文档中的原始代码失败的方式相同.
我也查看了http-get函数,但是"在缓冲区中获取URL" - 这不是我需要的.我不需要它在缓冲区中,我需要它在变量中.
在使用广义时间差分(例如SARSA,Q学习)的任何标准强化学习算法中,出现的问题是用于特定任务的λ和伽马超参数的值.
我知道lambda与资格痕迹的长度有关,而gamma可以解释为折扣未来的奖励多少,但是我怎么知道我的lambda值对于给定的任务来说太低了,或者我的gamma太高了?
我意识到这些问题没有明确定义的答案,但是知道某些"危险信号"会产生不适当的价值会非常有用.
以标准推车杆或倒立摆任务为例.我应该将gamma设置为高,因为它需要很多步骤来使任务失败,或者因为状态信息完全是Markovian而需要低吗?而且我甚至无法理解lambda值......
artificial-intelligence machine-learning markov reinforcement-learning
我是d3.js库的新手.
我正在尝试创建一个像这样的树,但是有一个链接到每个节点上的外部页面.
可能吗?
我试图在每个节点上添加一个"svg:a",但是让所有的树都消失了.
更新:
我从上面链接的页面的html中获取此代码.
链接的图书馆是:
这是所有代码:
<style type="text/css">
.node circle {
cursor: pointer;
fill: #fff;
stroke: steelblue;
stroke-width: 1.5px;
}
.node text {
font-size: 11px;
}
path.link {
fill: none;
stroke: #ccc;
stroke-width: 1.5px;
}
</style>
<script>
var m = [20, 120, 20, 120],
w = 1280 - m[1] - m[3],
h = 800 - m[0] - m[2],
i = 0,
root;
var tree = d3.layout.tree()
.size([h, w]);
var diagonal …Run Code Online (Sandbox Code Playgroud) 我一直在阅读Peter Seibel Practical Common Lisp的优秀书籍,以解决我一直在做的与Common Lisp错误处理系统相关的研究.
虽然我已经阅读了书中的解释并试图在网上挖掘一些信息,但我无法理解STORE-VALUE和USE-VALUE重启的含义和用法.有人可以解释这些功能的目的是什么?
;;; Example of the STORE-VALUE and USE-VALUE restarts
(defun careful-symbol-value (symbol)
(check-type symbol symbol)
(restart-case (if (boundp symbol)
(return-from careful-symbol-value
(symbol-value symbol))
(error 'unbound-variable
:name symbol))
(use-value (value)
:report "Specify a value to use this time."
value)
(store-value (value)
:report "Specify a value to store and use in the future."
(setf (symbol-value symbol) value))))
Run Code Online (Sandbox Code Playgroud) lisp error-handling exception-handling common-lisp condition-system
在Common Lisp中,我可以评估以下代码片段(在SBCL中),而不会发出任何语法错误信号:
(let ((x 0))
(defun my-incf (y)
(setf x (+ x y)))
(defun my-decf (y)
(setf x (- x y))))
MY-DECF
CL-USER> (my-incf 1)
1
CL-USER> (my-incf 1)
2
CL-USER> (my-decf 1)
1
CL-USER> (my-decf 1)
0
Run Code Online (Sandbox Code Playgroud)
当我尝试评估相应的Scheme代码片段时(在DrRacket中):
(let ((x 0))
(define (my-incf y)
(set! x (+ x y)))
(define (my-decf y)
(set! x (- x y))))
Run Code Online (Sandbox Code Playgroud)
它表示语法错误.
begin (possibly implicit): no expression after a sequence of internal definitions in: (begin (define (my-incf y) (set! x (+ x y))) …Run Code Online (Sandbox Code Playgroud) 在阅读了有关声明SPECIAL 的文档、特殊运算符LET、宏DEFVAR以及 StackOverflow 上关于 Common Lisp 中动态与词法范围的几个问题之后,例如,this 之后,我仍然无法理解以下行为在 SBCL 中评估这些形式。
;; x is a free variable
CL-USER> (defun fn ()
(print x))
; in: DEFUN FN
; (PRINT X)
;
; caught WARNING:
; undefined variable: X
;
; compilation unit finished
; Undefined variable:
; X
; caught 1 WARNING condition
FN
CL-USER> (describe 'x)
COMMON-LISP-USER::X
[symbol]
; No value
CL-USER> (let ((x 'dinamic_1st_binding))
(declare (special x))
(print x)
(fn)
(let …Run Code Online (Sandbox Code Playgroud) 我希望John McCarthy还活着,但......
LISP可以解释和执行以S表达式形式编写的程序.因此,与机器语言一样,并且与大多数其他更高级语言不同,它可以用于生成用于进一步执行的程序.
我需要更多关于机器语言如何用于生成程序以及Lisp如何实现它的澄清?
lisp machine-language s-expression computer-science-theory racket
我正在尝试使用正则表达式在字符串中查找三个连续的大写字母。
我试过使用:
\b([A-Z]){3}\b
Run Code Online (Sandbox Code Playgroud)
作为我的正则表达式在一定程度上有效。
但是,这只会自行返回字符串。我还希望它找到嵌套在字符串中的三个连续的大写字母。即thisISAtest。
lisp ×7
common-lisp ×5
d3.js ×1
elisp ×1
emacs ×1
javascript ×1
let ×1
markov ×1
python ×1
python-3.x ×1
racket ×1
regex ×1
s-expression ×1
scheme ×1
scoping ×1
tree ×1