Alan Kay说,仔细阅读代码并找到Lisp 1.5手册第13页代码中唯一的错误,帮助他更好地理解计算机科学100倍.
有问题的代码是eval&的第一个版本,apply它看起来像现代的lisp(我知道).
既然正确的答案可能已知但丢失了(我的google-fu很不错,我至少搜索了20分钟)我将奖励第一个正确的答案(我将查看编辑时间,所以不要试图作弊)尽快获得250点赏金.
我会建议其他人也为赏金做出贡献,记得上面的视频Alan Kay说这些东西让人回想起爱因斯坦在发现相对论时所处的环境.
文本中的代码用M-Expressions编写.我正在翻译从M表达式转换为S表达式(lisp代码)@ https://github.com/Viruliant/MccarthyMCEval-1.5.
无论如何这里是第13页的翻译引用:
;______________________________________Lisp Meta-Circular Evaluator S-Expression
;this code is written in the order it appears on pages 10-13 in the Lisp 1.5 Manual
;and is translated from the m-expressions into s-expressions
(label mc.equal (lambda (x y)
(mc.cond
((atom x) ((mc.cond ((atom y) (eq x y)) ((quote t) (quote f)))))
((equal (car x)(car y)) (equal (cdr x) (cdr y)))
((quote …Run Code Online (Sandbox Code Playgroud) 如何重新实例化已经声明的base64数据网址图像而不必在同一页面上重新插入base64代码?(最好用css)
我试过了:
<html><head>
<style type="text/css">
img.wink { width:15px; height:15px;
src:"data:image/.gif;base64,R0lGODlhDwAPALMMAP/qAEVFRQAAAP/OAP/JAP6dAP+0AP/+k//9E///x//lAP//6wAAAAAAAAAAAAAAACH5BAEAAAwALAAAAAAPAA8AAARXkEkZap2Y1ZXOGRcWcAgCnEMRTEEnnDCQrtrxxjCoJSZw+y+CKnDo/WAEQ+WAwyUrvWZQGRg0TwKFcFX1xYI6zWCgEJizhBlrTGi31aKAYW4YZlgW2iQCADs=";
}
</style>
</head><body>
<h1>Hello</h1>
<img class="wink"/>, and just to test my sanity <img width="15px" height="15px" src="data:image/.gif;base64,R0lGODlhDwAPALMMAP/qAEVFRQAAAP/OAP/JAP6dAP+0AP/+k//9E///x//lAP//6wAAAAAAAAAAAAAAACH5BAEAAAwALAAAAAAPAA8AAARXkEkZap2Y1ZXOGRcWcAgCnEMRTEEnnDCQrtrxxjCoJSZw+y+CKnDo/WAEQ+WAwyUrvWZQGRg0TwKFcFX1xYI6zWCgEJizhBlrTGi31aKAYW4YZlgW2iQCADs=" alt=";)"/>.
</body></html>
Run Code Online (Sandbox Code Playgroud) 您使用什么标准命名约定和/或数学库?我目前正在使用
#include <stdint.h>
typedef float float32_t;
typedef double float64_t;
/*! ISO C99: 7.18 Integer types 8, 16, 32, or 64 bits
intN_t = two’s complement signed integer type with width N, no padding bits.
uintN_t = an unsigned integer type with width N.
floatN_t = N bit IEE 754 float.
uintN_t intN_t floatN_t
bits unsigned-integer signed-integer IEE754 float
8
16 unsigned short short ??"half"
32 unsigned int float
64 unsigned long long double
128 ?? "Long double" "quad" ??*/
Run Code Online (Sandbox Code Playgroud)
但是你可以看到我还没有决定数学库. …
有没有办法用标准的perl库来打开文件并对其进行编辑,而不必关闭它然后再打开它?我所知道的只是将文件读入一个字符串中关闭文件然后用一个新文件覆盖该文件; 或者读取然后追加到文件的末尾.
以下目前有效; 我必须打开它并关闭它两次,而不是一次:
#!/usr/bin/perl
use warnings; use strict;
use utf8; binmode(STDIN, ":utf8"); binmode(STDOUT, ":utf8");
use IO::File; use Cwd; my $owd = getcwd()."/"; # OriginalWorkingDirectory
use Text::Tabs qw(expand unexpand);
$Text::Tabs::tabstop = 4; #sets the number of spaces in a tab
opendir (DIR, $owd) || die "$!";
my @files = grep {/(.*)\.(c|cpp|h|java)/} readdir DIR;
foreach my $x (@files){
my $str;
my $fh = new IO::File("+<".$owd.$x);
if (defined $fh){
while (<$fh>){ $str .= $_; }
$str =~ s/( |\t)+\n/\n/mgos;#removes trailing spaces or …Run Code Online (Sandbox Code Playgroud) 原来这只是"c ++不是c布鲁斯"的另一个案例
我想要的是
const char hex[16] = "0123456789ABCDEF";
Run Code Online (Sandbox Code Playgroud)
唯一有效的
char hex[16] = "0123456789ABCDE"; hex[15] = "F";
Run Code Online (Sandbox Code Playgroud)
是否有任何编译器选项或我可以做的事情使gcc编译器中的字符串不为null终止.这样我就可以制作一个(n)常数数组
我在使用与Internet Explorer一起使用css(使用文本变量)的函数时遇到了问题,但它适用于Firefox和Chrome.
/*! addCssStyle() applies the text value $CssText$ to the the specified document
$Doc$ e.g. an IFrame; or if none specified, default to the current document,
*/function addCssStyle(CssText, Doc){
//Secure $Head$ for the current $Doc$
Doc = Doc||document; var head = Doc.getElementsByTagName('head')[0];
if(!head || head == null){
head = Doc.createElement('div'); Doc.body.appendChild(head);
} if(!head || head == null){return false;}
//createElement('style')
var PendingStyle = Doc.createElement('style');
// if (is_gecko){PendingStyle.href = 'FireFox.css';}//???needeed???
PendingStyle.type = 'text/css';
PendingStyle.rel = 'stylesheet';
// PendingStyle.media = 'screen';//???needeed??? …Run Code Online (Sandbox Code Playgroud) 当前版本的UTF-16只能编码1,112,064个不同的数字(代码点);0x0-0x10FFFF。
Unicode联合会打算使UTF-16用完字符吗?
即设定一个代码点> 0x10FFFF
如果不是,为什么有人会为utf-8解析器编写代码,使其能够接受5个或6个字节的序列?因为这会在其功能中添加不必要的指令。
1,112,064还不够,我们实际上需要更多字符吗?我的意思是:我们快用完了吗?
有没有办法在运行时更改node.js?
就像在运行时编辑 javascript 文件,然后在运行时它会相应地更改。
我想打印至少提取的print#文件,从运行tarball提取
xz -dc /path/to/somearchive.tar.xz | sudo tar xvpf - -C /path/to/some_directory
Run Code Online (Sandbox Code Playgroud)
我在考虑使用作为中提到的"\ r"的这个问题,例如
num=0
when [\n received]
num=$(($num + 1))
echo -ne "$num files extracted \r"
end when
Run Code Online (Sandbox Code Playgroud)
我的bash技能让我失望.
如何将"哈希数组"元素作为数组传递给函数?
比方说,我想将所有$link->{text}数组作为数组传递给sort()函数.
#!/usr/bin/perl
use strict; use warnings;
my $field = <<EOS;
<a href="baboon.html">Baboon</a>
<a href="antelope.html">Antelope</a>
<a href="dog.html">dog</a>
<a href="cat.html">cat</a>
EOS
#/ this comment is to unconfuse the SO syntax highlighter.
my @array_of_links;
while ($field =~ m{<a.*?href="(.*?)".*?>(.*?)</a>}g) {
push @array_of_links, { url => $1, text => $2 };
}
for my $link (@array_of_links) {
print qq("$link->{text}" goes to -> "$link->{url}"\n);
}
Run Code Online (Sandbox Code Playgroud) 我将如何切换文本换行JTextpane?
public JFrame mainjFrame = new JFrame("Text Editor");
public JTextPane mainJTextPane = new JTextPane();
public JScrollPane mainJScrollPane = new JScrollPane(mainJTextPane);
mainjFrame.add(mainJScrollPane);
Run Code Online (Sandbox Code Playgroud) 在 R5RS Scheme 中,如何通过一次调用显示多个参数?我下面的实现有效,但添加了额外的括号和空格。
#!/usr/bin/env racket
#lang r5rs
(define (display-all . rest) (display rest))
(display-all "I " "have " "a " "lovely " "bunch " "of " "coconuts\n")
Run Code Online (Sandbox Code Playgroud)
结果是
owner@K53TA:~$ ./Template.ss
(I have a lovely bunch of coconuts
)
Run Code Online (Sandbox Code Playgroud) c ×2
lisp ×2
perl ×2
arrays ×1
base64 ×1
bash ×1
c++ ×1
css ×1
data-url ×1
eval ×1
file ×1
file-io ×1
gcc ×1
hash ×1
html ×1
interpreter ×1
java ×1
javascript ×1
jtextpane ×1
lambda ×1
loops ×1
math ×1
metacircular ×1
node.js ×1
r5rs ×1
racket ×1
scheme ×1
string ×1
swing ×1
tar ×1
unicode ×1
utf-16 ×1
utf-8 ×1
webkit ×1
word-wrap ×1