每次启动Scala 2.9.2 REPL(Java HotSpot(TM)64位服务器VM,Java 1.8.0-ea)后,第一行代码执行都会给我带来错误:
scala> 1 + 2
error: error while loading CharSequence, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
(bad constant pool tag 15 at byte 1484)
Run Code Online (Sandbox Code Playgroud)
稍后在当前REPL实例的进一步评估期间,不会发生类似的错误.
有没有人建议如何处理这种行为?
Pythons memoryview不支持datetime64或timedelta.好.但是,当我尝试创建一个memoryview包含一个datetime64或的结构化数组时timedelta,它似乎可以工作...... 除非我将它分配给一个变量!
In [19]: memoryview(zeros(10, dtype=[("A", "m8[s]")]))
Out[19]: <memory at 0x7f1d455d6048>
In [20]: x = memoryview(zeros(10, dtype=[("A", "m8[s]")]))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
ValueError: cannot include dtype 'm' in a buffer
In [21]: x = _19
In [22]: x
Out[22]: <memory at 0x7f1d455d6048>
Run Code Online (Sandbox Code Playgroud)
这严重挑战了我对Python基本工作方式的理解.怎么能f()和x = f()不同,考虑到(1)IPythons REPL分配输出到_19反正,和(2)的函数/类memoryview没有知道什么是来电者会用它的输出做的呢?
我正在运行Python 3.4.1上的代码,numpy 1.10.0.dev + fbcc24f,在Linux 2.6.32-431.23.3.el6.x86_64,Scientific Linux发行版6.6上.
编辑
在Python …
python numpy read-eval-print-loop memoryview structured-array
我一直在使用Clojure一段时间,并希望创建一些比玩具更大更复杂的项目.我在过去的几年里一直在使用Java,并且已经习惯了IDE为我做的事情 - 编译了很多类,将它们打包在罐子里,为用户创建批处理文件以启动它们.
当我查看Clojure中的开发示例时,他们似乎是按照加载文件的方式进入REPL,看看它们是如何工作的,编辑文件,重新加载,重复.Nary在任何地方生成一个类或jar.在Stuart Halloway非常棒的"Programming Clojure"中,我找不到一个例如"gen-class"的例子.我使用的Clojure IDE(ClojureBox和enlojure NetBeans插件)似乎促进了相同的工作流程.
这是故意的吗?这些工具是不成熟还是我没有"得到它"?
我想听一些人们的工作流程示例,如果可能的话,他们创建了一些普通用户(而不是其他开发人员)使用的非平凡程序.
感谢您分享您的意见.
Objective-C有REPL吗?
我正在学习Objective-C,并且非常缺少一个来自Python背景的REPL.
当我从命令行运行类似下面的内容时,会发生什么?
> scala hello.scala
Run Code Online (Sandbox Code Playgroud)
是否有生成,执行,然后丢弃的hello.class?或者Scala在这种情况下表现得像某个解释器?我只是想,当然,我不能对Java做同样的事情:
> java hello.java
Run Code Online (Sandbox Code Playgroud) 在基于解放者的clojure项目中,我们使用datomic作为DB.在将我们的本地dev数据库迁移到S3托管的数据库并在我们的project.clj上添加所需的依赖项后,我们无法启动REPL但是Liberator堆栈运行正常lein run
我的猜测是数据库连接搞砸了,所以问题是,我怎么能以某种方式"调试"或弄清楚这种lein repl超时的原因是什么?
我的project.clj
(defproject myproject "0.1.0-SNAPSHOT"
:main myproject.core
:jvm-opts ["-Xmx1G"]
:datomic {:schemas ["resources" ["myproject-schema.edn" ]]}
:plugins [[lein-ring "0.8.10"]]
; cp bin/transactor config/samples/free-transactor-template.properties resources/transactor.properties
:profiles {:dev
{:datomic {
; :config resources/transactor.properties
; :db-uri "datomic:free://127.0.0.1:4334/myproject"}
:db-uri "datomic:ddb://us-east-1/datomica/myproject"}
:dependencies [[ring-mock "0.1.5"]
[midje "1.5.1"]
]
}
}
:dependencies [[org.clojure/clojure "1.5.1"]
[com.datomic/datomic-pro "0.9.4556"]
; [com.datomic/datomic-free "0.9.4470"]
[com.cemerick/friend "0.2.0"]
[liberator "0.10.0"]
[compojure "1.1.5"]
[http-kit "2.1.13"]
[cheshire "5.1.1"]
[ring/ring-jetty-adapter "1.1.0"]
[ring/ring-devel "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[url62 "1.0.0-SNAPSHOT"]
[clj-http "0.7.8"]
[org.clojars.nathell/clojure-contrib "1.2.0"]
[com.taoensso/timbre "3.0.0-RC4"] …Run Code Online (Sandbox Code Playgroud) 我开始使用C#Interactive,就像我可以浏览和探索一些API功能,就像我一样,Immediate无需运行和调试我的程序.
问题是,除非我使用变量名执行命令,否则它不会像立即那样输出信息:
> string.Format("{0,15}", 10m); //hit enter, here there is no output
> var a = string.Format("{0,15}", 10m); //hit enter so...
> a // hit enter and...
" 10" //...here the value is shown
>
Run Code Online (Sandbox Code Playgroud)
有没有办法C# Interactive在每个评估中输出值,就像Immediate那样(并且没有为此编写更多代码Console.Write)?
c# read-eval-print-loop roslyn visual-studio-2015 c#-interactive
我正在使用emacs的控制台版本(也就是说,我已经通过SSH连接到远程计算机并在那里使用emacs)而且我想知道如何(假设可能)从那里启动REPL.我是Lisp和emacs的新手.
在python REPL中我可以做以下事情:
>>> [1,2,3,4]
[1, 2, 3, 4]
>>> sum(_)
10
Run Code Online (Sandbox Code Playgroud)
在clojure REPL中,我可以这样做:
user=> "Hello!"
"Hello!"
user=> *1
"Hello!"
Run Code Online (Sandbox Code Playgroud)
Scala REPL中有类似的东西吗?
举个例子:
>>> 5+10
15
>>> a = 5 + 10
>>> a
15
Run Code Online (Sandbox Code Playgroud)
如果没有明确的print语句,Python如何以及为什么这样做?
如果我在IPython单元格中执行相同的操作,那么实际上只有最后一个这样的值以这种方式打印在stdout上:
In[1]: 5+10
1
Out[1]: 1
Run Code Online (Sandbox Code Playgroud)
为什么会这样?