:t myfunctionofinterest
Run Code Online (Sandbox Code Playgroud)
对于我在库中使用的函数.
但是,当我在我的项目根目录中运行时
$ stack ghci
Run Code Online (Sandbox Code Playgroud)
我的Main.hs有:
import MyLib
Run Code Online (Sandbox Code Playgroud)
我的模块做了:
module MyLib {
bunchOfFunctions -- but not myfunctionofinterest
} where
import SomeDB.ModuleThatExposes -- myfunctionofinterest
myfunc :: IO ()
myfunc = do
myfunctionofinterest a b c -- place where I misuse myfunctionofinterest and could have used :t on it to see it had 3 args
Run Code Online (Sandbox Code Playgroud)
我不能:t在主要的myfunctionofinterest,因为它没有暴露,也没有Import MyLib.myfunctionofinterest明确的帮助,因为它是在导入中定义的东西.虽然我知道我可以暴露它然后检查它,:a编译,然后编辑lib再次隐藏它,有没有什么允许更快,更直接?
这似乎必须是一种常见的模式.当您需要在开发时检查库中使用的类型时,您会怎么做?
我有一个TODO项目列表,我试图在同一个文件中有2个TODO列表,但似乎无法结束第一个.
FIRST LIST: TODAY
* TODO Item 1
Description
* TODO Item 2
Description
SECOND LIST: TOMORROW
* TODO Item 3
Description
* TODO Item 4
Description
Run Code Online (Sandbox Code Playgroud)
不幸的是,SECOND LIST: TOMORROW现在是描述的一部分TODO Item 2.通过这个,我的意思是当我点击shift-tab时,我不再看到文本,SECOND LIST: TOMORROW因为它折叠了TODO Item 2.我看到的是......
FIRST LIST: TODAY
* TODO Item 1
* TODO Item 2
* TODO Item 3
* TODO Item 4
Run Code Online (Sandbox Code Playgroud)
虽然我想看到的是......
FIRST LIST: TODAY
* TODO Item 1
* TODO Item 2
SECOND LIST: TOMORROW
* TODO …Run Code Online (Sandbox Code Playgroud) 我有一个输出TRUE或FALSE的R脚本.在R中,它使用了真正的T/F数据类型,但当我将其返回值回显为bash时,它似乎是一个字符串,说:
"[1] TRUE"
要么
"[1] FALSE"
它们都先于[1].也不是[0],这不是拼写错误.无论如何,这样做的结果是什么,当我尝试测试这个RSCRIPT的输出运行的后续脚本,我要做的字符串比较"[1] TRUE",如下图,而不是比较"真"或者" 1"感觉更干净,更好.
A=$(Rscript ~/MyR.r)
echo $A
if [ "$A" == "[1] TRUE" ]; then
bash SecondScript.sh
fi
Run Code Online (Sandbox Code Playgroud)
如何让R输出一个真正的布尔值,或者Bash接受输出字符串并将其转换为0/1进行比较?也就是说,我宁愿测试......
if [ $A == TRUE ];
Run Code Online (Sandbox Code Playgroud)
比
if [ "$A" == "[1] TRUE" ];
Run Code Online (Sandbox Code Playgroud)
这是可能的,或者我应该对此感到满意,它是如何的,哪个有效?
*更新*
这是产生这个的Rscript的最小化版本......
myinput <- TRUE #or FALSE
FunctionName <- function(test){
if (test == TRUE){
val <- TRUE
} else {
val <- FALSE
}
return(val)
}
FunctionName(myinput)
Run Code Online (Sandbox Code Playgroud) 库中是否有预先构建的功能tm,或者可以很好地使用它?
我当前的语料库被加载到tm,如下所示:
s1 <- "This is a long, informative document with real words and sentence structure: introduction to teaching third-graders to read. Vocabulary is key, as is a good book. Excellent authors can be hard to find."
s2 <- "This is a short jibberish lorem ipsum document. Selling anything to strangers and get money! Woody equal ask saw sir weeks aware decay. Entrance prospect removing we packages strictly is no smallest he. For hopes may chief get hours …Run Code Online (Sandbox Code Playgroud) 我从这个问题中了解到,CEDET安装在emacs 24中而无需额外安装,所以我不需要在这里遵循这些说明,也不需要在此处遵循CEDET部分.
我没有使用emacs入门套件,就像这个答案一样.
所以,当我使用elpa安装ecb时,我收到以下错误:
Compiling file /home/mittenchops/.emacs.d/elpa/ecb-20131116.1319/ecb2/jn-file-tree.el at Mon Dec 30 16:13:57 2013
Entering directory `/home/mittenchops/.emacs.d/elpa/ecb-20131116.1319/ecb2/'
jn-file-tree.el:31:1:Error: Cannot open load file: jn-tree-node
Compiling file /home/mittenchops/.emacs.d/elpa/ecb-20131116.1319/ecb2/jn-tree-node.el at Mon Dec 30 16:13:57 2013
jn-tree-node.el:32:1:Error: Cannot open load file: jn-utils
Compiling file /home/mittenchops/.emacs.d/elpa/ecb-20131116.1319/ecb2/jn-tree-view.el at Mon Dec 30 16:13:57 2013
jn-tree-view.el:31:1:Error: Cannot open load file: jn-window
Compiling file /home/mittenchops/.emacs.d/elpa/ecb-20131116.1319/ecb2/jn-utils.el at Mon Dec 30 16:13:57 2013
Compiling file /home/mittenchops/.emacs.d/elpa/ecb-20131116.1319/ecb2/jn-window.el at Mon Dec 30 16:13:57 2013 …Run Code Online (Sandbox Code Playgroud) 我明白 "." (点)作为功能组合.我理解"|" (管道)作为"或",警卫介绍语法(从这里 ),但我在http-conduit上看到了一个使用".|"的答案.以我不理解的方式使用此运算符.
我发现的其他管道参考,例如:
...建议语法如"$$","$ =","= $ =","= $"用于组合数据流中的管道.
我该怎么称呼这个".|" 这个运算符,它是如何工作的?
可以预见的是,Google搜索".| haskell"或"'dot pipe'haskell"或"'dot pipe'haskell运营商管道"并不是很成功.
我看到create函数带有一个Identifier列表.
ghci ?> :t create
create :: [Identifier] -> Rules () -> Rules ()
Run Code Online (Sandbox Code Playgroud)
我应该使用什么标识符列表来匹配站点的根目录?例如,我只想制作一个单独的html页面,该页面出现在"www.example.com"上,没有"/ posts"或"/ archives"或任何其他域名部分.
我试过几个:
create "/" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
Run Code Online (Sandbox Code Playgroud)
和
create "/*" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
Run Code Online (Sandbox Code Playgroud)
和
create "." $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
Run Code Online (Sandbox Code Playgroud)
和
create "./" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= …Run Code Online (Sandbox Code Playgroud) I'm using emacs and anaconda.
I have this in my init.el:
(setenv "WORKON_HOME" "/home/user/anaconda3/envs/")
Run Code Online (Sandbox Code Playgroud)
And conda on my path:
# added by Anaconda3 installer
export PATH="/home/user/anaconda3/bin:$PATH"
Run Code Online (Sandbox Code Playgroud)
but emacs can't find my conda environments, which I understand it is supposed to be able to do..
So, when I run C-c C-p to start a new session, and C-c C-c, it fails to import my packages which are installed in a conda environment, with ModuleNotFoundError.
Since I have added this …
我正在研究这个colab笔记本:
我想用ELMo嵌入替换gnews旋转嵌入。
因此,更换
model = "https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1"
Run Code Online (Sandbox Code Playgroud)
与:
model = "https://tfhub.dev/google/elmo/2"
Run Code Online (Sandbox Code Playgroud)
这里发生了一系列变化,例如需要
tf.compat.v1.disable_eager_execution()
Run Code Online (Sandbox Code Playgroud)
但是我不了解要成功完成此替换的图形形状。具体来说,我看到了。
#model = "https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1"
model = "https://tfhub.dev/google/elmo/2"
elmo = hub.Module(model, trainable=True, name="{}_module".format("mymod"))
hub_layer = hub.KerasLayer(elmo,
# output_shape=[3,20],
# input_shape=(1,),
dtype=tf.string,
trainable=True)
hub_layer(train_examples[:3])
Run Code Online (Sandbox Code Playgroud)
产生
<tf.Tensor 'keras_layer_14/mymod_module_14_apply_default/truediv:0' shape=(3, 1024) dtype=float32>
Run Code Online (Sandbox Code Playgroud)
这似乎很好。但:
model = tf.keras.Sequential()
model.add(hub_layer)
model.add(tf.keras.layers.Dense(16, activation='relu'))
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
# First, I have to build, because I no longer have eager executon.
model.build(input_shape=(None,1024))
model.summary()
Run Code Online (Sandbox Code Playgroud)
然后给出:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-54-8786753617e4> in <module>()
4 model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
5 …Run Code Online (Sandbox Code Playgroud) 我正在看这个图书馆,那里没有多少文档:https : //pythonhosted.org/parsec/#examples
我知道还有其他选择,但我想使用这个库。
我想解析以下字符串:
mystr = """
<kv>
key1: "string"
key2: 1.00005
key3: [1,2,3]
</kv>
<csv>
date,windspeed,direction
20190805,22,NNW
20190805,23,NW
20190805,20,NE
</csv>"""
Run Code Online (Sandbox Code Playgroud)
虽然我想解析整个事情,但我只想抓住<tags>。我有:
>>> import parsec
>>> tag_start = parsec.Parser(lambda x: x == "<")
>>> tag_end = parsec.Parser(lambda x: x == ">")
>>> tag_name = parsec.Parser(parsec.Parser.compose(parsec.many1, parsec.letter))
>>> tag_open = parsec.Parser(parsec.Parser.joint(tag_start, tag_name, tag_end))
Run Code Online (Sandbox Code Playgroud)
好,看起来不错 现在使用它:
>>> tag_open.parse(mystr)
Traceback (most recent call last):
...
TypeError: <lambda>() takes 1 positional argument but 2 were given
Run Code Online (Sandbox Code Playgroud)
这失败了。恐怕我什至不明白我的lambda表达式给出两个参数的含义,这很明显是1.如何进行?
对于所有奖励积分,我的最佳期望输出是: …