TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Csexp: S-Expressions over the Network

109 点作者 thefilmore将近 2 年前

4 条评论

Jtsummers将近 2 年前
See also: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Canonical_S-expressions" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Canonical_S-expressions</a><p>Canonical S-Expressions developed by Ron Rivest. I&#x27;m surprised that this page doesn&#x27;t reference it as prior art since it seems to be very close to the same, if not the same, construct.<p><a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20070120051303&#x2F;http:&#x2F;&#x2F;theory.lcs.mit.edu&#x2F;~rivest&#x2F;sexp.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20070120051303&#x2F;http:&#x2F;&#x2F;theory.lcs...</a><p><a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20061231133857&#x2F;http:&#x2F;&#x2F;theory.lcs.mit.edu&#x2F;~rivest&#x2F;sexp.txt" rel="nofollow noreferrer">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20061231133857&#x2F;http:&#x2F;&#x2F;theory.lcs...</a>
评论 #36284644 未加载
评论 #36284292 未加载
JonChesterfield将近 2 年前
Doesn&#x27;t say anything about cycles or what datatypes can be serialised. In general lisps _can&#x27;t_ print arbitrary objects in a form that can be read back in. E.g.<p><pre><code> Welcome to Racket v7.9 [bc]. &gt; (lambda (x) x) #&lt;procedure&gt; </code></pre> 7.9 doesn&#x27;t have csexp, was curious what it would do with a function object but not quite curious enough to install a racket from outside the package manager. It seems relatively likely that racket would have some serialisation feature that can round trip arbitrary objects through a bytestring though initial guesses haven&#x27;t worked out for me<p><pre><code> &gt; (require racket&#x2F;serialize) &gt; (serializable? (lambda (x) x)) #f </code></pre> Still, being able to take some arbitrary closure and kick it over the network to another racket instance would be great. It&#x27;s not immediately obvious that csexp can do that.
评论 #36284880 未加载
评论 #36283848 未加载
评论 #36284233 未加载
评论 #36284150 未加载
评论 #36289256 未加载
评论 #36285051 未加载
schemescape将近 2 年前
Is there anything similar for Common Lisp?<p>For now, I’m using JSON because I’m paranoid about code injection attacks around print&#x2F;read.<p>I’ve seen a handful of libraries, but each one claims to protect against a different kind of attack, so that makes me think they might be vulnerable to the ones they <i>don’t</i> mention.<p>Edit: I’m not sure if I understood this submission properly, but I’ll leave my question up since I’m still interested.<p>Edit again: looks like someone asked this exact question on SO: <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;34813891&#x2F;how-do-you-securely-parse-untrusted-input-in-common-lisp" rel="nofollow noreferrer">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;34813891&#x2F;how-do-you-secu...</a>
评论 #36284469 未加载
评论 #36284138 未加载
评论 #36284357 未加载
评论 #36284227 未加载
kazinator将近 2 年前
I did a length:data encoding in the fake Lisp-like library in cppawk. Haha.<p>For instance cons(1, 1) produces &quot;C1,1:12&quot;. Type code C followed by two decimal integers separated by a comma, terminated by colon, followed by the car&#x2F;cdr data. The decimal integers give the lengths of the car and cdr part after the colon.<p><a href="https:&#x2F;&#x2F;www.kylheku.com&#x2F;cgit&#x2F;cppawk&#x2F;tree&#x2F;cppawk-cons.1" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.kylheku.com&#x2F;cgit&#x2F;cppawk&#x2F;tree&#x2F;cppawk-cons.1</a><p>The list (1 2 3) looks like &quot;C1,12:1C1,6:2C1,0:3&quot; .<p>A cursory scan through the string tells us that there are three C&#x27;s, so three cells in there.<p>Note the C1,0:3 at the end: (3 . nil). nil is a zero length object: the empty string represents nil. So the cdr length of the last cell is zero.