我知道这很难实现,但我希望Racket能够实现它的"电池包含"承诺.我正在寻找一个像这样的功能:
> (define (between lst item spot)
(append (take lst spot)
(cons item (drop lst spot))))
> (between '(1 3) 2 1)
'(1 2 3)
Run Code Online (Sandbox Code Playgroud)
Racket是否包含任何此类内置设备?
我希望存在这样的东西:
> SELECT nrange(10)
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Run Code Online (Sandbox Code Playgroud)
类似于rangePython、Racket等语言中的功能。当然,如果 PostgreSQL 中不存在这样的函数,我会非常满意地知道解决这个问题的惯用方法。谢谢!
这与问题How can I generated a series of Repeating Numbers in PostgreSQL?有点不同。因为我并不是试图生成一系列重复的数字,而是生成一个连续数字的数组。
我把所有东西从include/git2带到/ usr/include,然后尝试编译以下程序:
#include <stdio.h>
#include <repository.h>
int main(void) {
puts("Hello, world!");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我用GCC编译它时,我收到以下错误:
maxwell@UNIX-PC:~$ gcc ok.c
In file included from /usr/include/common.h:16:0,
from /usr/include/repository.h:10,
from ok.c:2:
/usr/include/inttypes.h:33:2: error: #error "Use this header only with Microsoft Visual C++ compilers!"
In file included from /usr/include/inttypes.h:46:0,
from /usr/include/common.h:16,
from /usr/include/repository.h:10,
from ok.c:2:
/usr/include/stdint.h:33:2: error: #error "Use this header only with Microsoft Visual C++ compilers!"
In file included from /usr/include/inttypes.h:46:0,
from /usr/include/common.h:16,
from /usr/include/repository.h:10,
from ok.c:2:
/usr/include/stdint.h:89:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ …Run Code Online (Sandbox Code Playgroud) 我正在使用V8(通过Chrome)对此进行测试。在Javascript中,代码块的计算结果等于该代码块中最后一个值的计算结果。我想看看如果将变量分配给空代码块会发生什么。
// example of code block evaluating to last value in the block
> {1;2;3};
3
// This won't work, it returns an empty object,
// not an empty code block.
> var emptyBlock = {};
> emptyBlock;
Object object
Run Code Online (Sandbox Code Playgroud)
最终,我弄清楚了如何指定我想要一个空的代码块,而不是一个空的对象。
> {;}
undefined
> {;;}
undefined
> {;;;;;}
undefined
Run Code Online (Sandbox Code Playgroud)
好吧,很漂亮,所以一个空的代码块解析为undefined。对?
> var emptyBlock = {;}
Uncaught SyntaxError: Unexpected token ';'
Run Code Online (Sandbox Code Playgroud)
?!现在还不清楚空代码块是否实际上返回了undefined,或者其他的东西正在起作用。如果仅对进行评估undefined,则我们希望以上分配能够正常工作。
有人知道为什么会这样吗?
我正在对 GitHub Gist API 进行未经身份验证的调用,并且我已经超出了速率限制。尝试浏览到https://api.github.com/users/seisvelas/gists?page=1&per_page=100,我收到:
{
"message": "API rate limit exceeded for 187.188.105.159. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://developer.github.com/v3/#rate-limiting"
}
Run Code Online (Sandbox Code Playgroud)
我浏览了建议的文档,它建议我查看X-RateLimit-Reset:响应标头,所以我这样做了。我的响应标头如下所示:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1566344009
Run Code Online (Sandbox Code Playgroud)
好的,所以我被允许 60 个请求。但是速率限制重置的时间以1566344009...单位给出。我不确定这些单位的测量单位是什么。毫秒?如果是这样,那将意味着我每 ~18 天允许 60 个请求。这似乎有点保守,但并非不可能,但我更想确切地知道速率限制时间的测量单位是什么。
我没有看到有关文档的任何建议,因此非常感谢任何帮助!谢谢!
c ×1
gist ×1
git ×1
github ×1
github-api ×1
javascript ×1
libgit2 ×1
linux ×1
lisp ×1
postgresql ×1
racket ×1
scheme ×1
sql ×1
v8 ×1