小编haw*_*eye的帖子

仅使用LISP原语定义defmacro函数?

麦卡锡的基本S函数和谓语atom,eq,car,cdr,cons

接着,他添加到他的基本符号,以便能够写他所谓的S-功能:quote,cond,lambda,label

在此基础上,我们将这些称为"LISP原语"(尽管我对类型谓词的论证持开放态度numberp)

如何defmacro在您选择的LISP中仅使用这些原语来定义函数?(包括计划和Clojure)

lisp macros primitive scheme clojure

11
推荐指数
1
解决办法
1355
查看次数

图书清单 - 使用Excel VBA条形码查找从亚马逊获取图书详细信息

我有一个条形码阅读器和一堆书.对于每本书,我想在Excel电子表格中列出书名和作者.

我的观点是,一些连接到Amazon Web服务的VBA代码会使这更容易.

我的问题是 - 以前没有人这样做过吗?你能指点我最好的例子吗?

excel vba barcode excel-vba amazon-web-services

11
推荐指数
1
解决办法
1万
查看次数

Gradle - 无法为参数找到方法mavenRepo()

我已经克隆了Cascading Pattern项目,安装了 Gradle 2.0 - 运行和推荐

gradle eclipse --stacktrace
Run Code Online (Sandbox Code Playgroud)

我得到以下 - 根本原因是什么?

J-MacBook-Pro:pattern J$ gradle eclipse --stacktrace

FAILURE: Build failed with an exception.

* Where:
Script '/Users/J../Documents/.../pattern/etc/s3Upload.gradle' line: 28

* What went wrong:
A problem occurred evaluating script.
> Could not find method mavenRepo() for arguments [{name=monochromeroad, url=http://conjars.org/repo/}] on repository container.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating script.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:132) …
Run Code Online (Sandbox Code Playgroud)

cascading gradle

11
推荐指数
1
解决办法
2万
查看次数

什么是有状态传感器?

在1.7版本的Clojure Core文档中 - 以下功能

dedupe
disj!
dissoc!
filter
keep
map
random-sample
remove
replace
take-while
Run Code Online (Sandbox Code Playgroud)

在其API描述中包含以下文本

Returns a transducer when no collection is provided.
Run Code Online (Sandbox Code Playgroud)

以及以下功能

drop
keep-indexed
partition-all
partition-by
take
take-nth
Run Code Online (Sandbox Code Playgroud)

有以下文字.

Returns a *stateful* transducer when no collection is provided.
Run Code Online (Sandbox Code Playgroud)

此外 - 对这一措辞提出了批评.

在此输入图像描述

我的问题是:什么是有状态传感器?即分组函数的相似之处.(这是说,之所以有人说键入一个传感器就需要依赖类型?)

clojure stateful transducer

11
推荐指数
1
解决办法
1357
查看次数

为什么JavaScript调试器在调试器语句处暂停?

我希望当我将JavaScript调试器语句插入到我的JavaScript代码中时,程序将在该点暂停,调试器将打开显示"断点".

我根本没看到这个.

这是我的代码.

<html>
  <script type="text/javascript">
  debugger;
  alert("Hello world!")
  </script>
  <body>
    <p>Hello world</p>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我运行它 - 我直接进入屏幕上的'警报'弹出窗口.我错过了什么步骤?

我的问题是:为什么JavaScript调试器在调试器语句处暂停?

(只是为了澄清 - 我打开了开发人员工具 - 但是在'控制台'选项卡上,而不是'来源'选项卡.)

javascript debugging

11
推荐指数
2
解决办法
4045
查看次数

javac.exe AST编程访问示例

是否可以通过编程方式访问javac.exe中的抽象语法树(AST)?你能提供一个例子吗?

java javac abstract-syntax-tree

10
推荐指数
2
解决办法
5613
查看次数

你能用十个原语实现任何纯LISP函数吗?(即没有类型谓词)

本网站提出以下声明:http: //hyperpolyglot.wikidot.com/lisp#ten-primitives

McCarthy introduced the ten primitives of lisp in 1960. All other pure lisp 
functions (i.e. all functions which don't do I/O or interact with the environment) 
can be implemented with these primitives. Thus, when implementing or porting lisp, 
these are the only functions which need to be implemented in a lower language. The 
way the non-primitives of lisp can be constructed from primitives is analogous to 
the way theorems can be proven from axioms in mathematics. …

lisp types predicate function clojure

10
推荐指数
1
解决办法
1370
查看次数

以下函数式编程模式的正确术语是什么?

我听说它被称为流,作为一个无限的列表,有时甚至作为一个懒惰的序列.

以下模式的正确用语是什么?(显示的Clojure代码)

(def first$ first)

(defn second$ [str]
  (cond
    (empty? str) ()
    true ((first (rest str)))))

(defn stream-builder [next_ n]
  (cons n (cons (fn [] (stream-builder next_ (next_ n))) ())))

(defn stream [str n]
  (cond
    (= 0 n) ()
    true (cons (first$ str) (stream (second$ str) (- n 1)))))

(def odd 
  (stream-builder (fn [n] 
        (+ 2 n))1))

(println (stream odd 23))

> (1 3 5 7 9 11 13 15 17 19 …
Run Code Online (Sandbox Code Playgroud)

lisp functional-programming terminology clojure sequence

10
推荐指数
2
解决办法
728
查看次数

Datomic - 需要对唯一ID进行明确的手动编码吗?

我的问题是 - Dataomic是否要求最终用户明确手动创建唯一序列号?或者只是提供的例子?

我正在阅读Datomic教程.

当我查看在seattle-data0.dtm中加载的数据时,我在前两行看到:

[
{:district/region :region/e, :db/id #db/id[:db.part/user -1000001], :district/name "East"}
{:db/id #db/id[:db.part/user -1000002], :neighborhood/name "Capitol Hill", :neighborhood/district #db/id[:db.part/user -1000001]}
Run Code Online (Sandbox Code Playgroud)

特别注意值

:db/id #db/id[:db.part/user -1000001],
:db/id #db/id[:db.part/user -1000002]
#db/id[:db.part/user -1000001]
Run Code Online (Sandbox Code Playgroud)

也许您可以帮助我理解 - 在准备插入数据时,这似乎明确需要手动生成的唯一ID序列号.

当然在现代数据库中,我们可以依靠数据库为我们生成序列号?

当我去做我自己的示例模式和数据插入时 - 我发现我也需要插入手动ID号.我错过了什么?

clojure datomic

10
推荐指数
1
解决办法
1111
查看次数

core.async和10,000个动画过程 - 这种情况下的实际好处是什么?

正如我们所知道- core.async 采用 CSP,类似于够程从去浪.现在对于像select和alt 这样的场景来说,这很有道理.

大卫·诺伦在这里做了一个惊人的演示,在Clojure中展示了Clojure中的core.async.

然而,我可以通过简单的for循环复制类似的功能.你可以在这里看到一个演示.

function animationLoop() {
    for (var i =0;i<100;i++) {
        for (var j= 0; j<100;j++) {
            //decision to animate or hold off
            var decisionRange = randomInt(0,10);
            if (decisionRange < 1) {
                var cell = document.getElementById('cell-' + i + j);
                cell.innerHTML = randomInt(0,9);
                cell.setAttribute('class','group' + randomInt(0,5));
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是在'10,000进程动画场景'中core.async的实际好处是什么?

clojure goroutine clojurescript core.async

10
推荐指数
1
解决办法
794
查看次数