我正在尝试开始Tools -> Start Haskell REPL,但是我收到了这个错误:
错误:无法运行程序"/usr/lib/ghc-7.8.4/bin/ghci"(在目录中......):error = 2,没有这样的文件或目录
哪个看起来合法,如同ghci其他地方一样:
$ locate ghci
/usr/bin/ghci
/usr/bin/ghci-7.8.4
/usr/lib/ghc-7.8.4/ghci-usage.txt
...
Run Code Online (Sandbox Code Playgroud)
(Haskell从专用存储库安装,Archlinux).不幸的是,我对Haskell SDK位置没有任何回旋余地.
Project Structure -> Project SDK -> GHC -> Select Home Directory for GHC
强迫/usr/lib/ghc-7.8.4我选择.
Prolog有什么问题?
Prolog非常适合列表和模式匹配,并提供回溯作为奖励.然而几十年来它仍然是一种语言,而功能语言开花繁衍.
以Erlang为例.它的语法来自Prolog,它最初是用Prolog实现的,这非常有趣.也就是说,从Erlang人的角度来看,Prolog存在根本性的错误,或者他们已经根据他们的需求调整了Prolog.
我想捕获一个字符串中的所有数字并返回一个整数向量,如下所示(结果可以是一个空向量):
fn str_strip_numbers(s: &str) -> Vec<isize> {
unimplemented!()
}
Run Code Online (Sandbox Code Playgroud)
一个 Python 原型:
def str_strip_numbers(s):
"""
Returns a vector of integer numbers
embedded in a string argument.
"""
return [int(x) for x in re.compile('\d+').findall(s)]
Run Code Online (Sandbox Code Playgroud)
因为"alfa"结果是[],因为"42by4"它是[42, 4]。
在 Rust 中获得它的惯用方法是什么?
更新:
fn str_strip_numbers(s: &str) -> Vec<String> {
lazy_static! {
static ref RE: Regex = Regex::new(r"\d+").unwrap();
}
RE.captures(s).and_then(|cap| {cap})
}
Run Code Online (Sandbox Code Playgroud)
我试过这样的事情,这在不止一个计数上是严重错误的。什么是正确的方法?
我只想要这样的诗歌:
$ pip install pydantic[email]
Run Code Online (Sandbox Code Playgroud)
我已阅读所有相关帖子。现在我的pyproject.toml看起来像这样(我也尝试了其他所有方法):
[tool.poetry.dependencies]
pydantic = {version = "*", optional = true, extras = ["email"]}
...
[tool.poetry.extras]
email = ["pydantic"]
Run Code Online (Sandbox Code Playgroud)
我还删除了.venv,poetry.lock然后$ poetry install。没有用。运行时错误很明显:
ImportError: email-validator is not installed, run `pip install pydantic[email]`
Run Code Online (Sandbox Code Playgroud)
我可以添加一个细节:它本身就是一种依赖项(在我遇到这个问题之前pydantic它是不存在的)。pyproject.toml
每本教科书都说Clojure数据结构是"不可变的,持久的".他们用不同的长度来解释这个概念,但到目前为止,我没有弄清楚不变性和持久性之间的区别.是否存在持久但可变的实体?或不可变但不持久?
假设我构建成功:
$ cargo build --release
...
Finished release [optimized] target(s) in 2m 52s
Run Code Online (Sandbox Code Playgroud)
有没有办法让它立即可供系统用户使用,而无需上传到注册表?
以 Python 为例,它看起来像这样:
myutility $ pip install dist/myutility-0.8.2-py3-none-any.whl --user
Run Code Online (Sandbox Code Playgroud)
myutility转到缓存
/home/user/.local/bin/myutility
Run Code Online (Sandbox Code Playgroud)
并且可以在任何地方使用:
~ $ myutility --help
Run Code Online (Sandbox Code Playgroud)
cargo我该如何使用 Rust (and )来做这样的事情呢?
我对gen-android命令的平台目标参数(SBT的android-sdk-plugin)感到茫然.谷歌也不是很有帮助.看起来必须有一种方式来质疑android sdk关于可用的平台目标(已安装)?
也没有gen-android用法示例.
这是一个新手问题,但我没有设法谷歌任何合理简洁但有启发性的主题.我有Sublime Text编辑器和一个优秀的插件DocBlockr https://github.com/spadgos/sublime-jsdocs,这使得正确的评论变得轻而易举.在完成评论后我该怎么做?至少,我希望能够在REPL中调用注释.还有哪些文档明智?对于中等脚本,我想要轻量级和简单的东西.
编辑:
var helper = exports.helper = (function() {
...
/**
* Reduces a sequence of names to initials.
* @param {String} name Space Delimited sequence of names.
* @param {String} sep A period separating the initials.
* @param {String} trail A period ending the initials.
* @param {String} hyph A hypen separating double names.
* @return {String} Properly formatted initials.
*/
function makeInits(name, sep, trail, hyph) {
function splitBySpace(nm) {
return nm.trim().split(/\s+/).map(function(x) {return …Run Code Online (Sandbox Code Playgroud) >>> import functools as ft
>>> bk = ft.reduce(lambda x, y: x[0] + "." + y[0], ['alfa', 'bravo', 'charlie', 'delta'])
>>> bk
'a.d'
>>> km = ft.reduce(lambda x, y: x + y, [1, 2, 3, 4])
>>> km
10
>>> bk = ft.reduce(lambda x, y: x[0] + y[0], ['alfa', 'bravo', 'charlie', 'delta'])
>>> bk
'ad'
>>>
Run Code Online (Sandbox Code Playgroud)
我期待像'abcd'或'abcd'这样的东西.不知怎的,无法解释结果.这里有类似的问题,但不完全像这个.
我一直在尝试根据通用准则设置一个测试示例:在Ionic中测试,Ionic GitHub示例
我的项目是package.json:
{
"name": "starter-with-testing",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"test": "karma start ./test-config/karma.conf.js"
},
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "4.7.0",
"@ionic-native/splash-screen": "4.7.0",
"@ionic-native/status-bar": "4.7.0",
"@ionic/storage": "2.1.3",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26" …Run Code Online (Sandbox Code Playgroud) rust ×2
sdk ×2
android ×1
clojure ×1
docstring ×1
erlang ×1
ghc ×1
haskell ×1
immutability ×1
javascript ×1
list ×1
node.js ×1
persistence ×1
platform ×1
prolog ×1
python ×1
python-3.x ×1
reduce ×1
regex ×1
rust-cargo ×1
sbt ×1
select ×1
string ×1
unit-testing ×1