小编nic*_*las的帖子

如何在不改变环境的情况下访问R中的数据

当我打开一个包时,比如说ggplot2,diamonds我的环境中定义了数据集.

有没有办法访问钻石数据集而不改变我的环境?喜欢

a <- ggplot2.data("diamonds")
Run Code Online (Sandbox Code Playgroud)

r dataframe

4
推荐指数
2
解决办法
97
查看次数

在XAML中数据绑定到父datacontext

这两个元素所在的用户控件具有名为ColumnTypes的属性.

每一元素用相同的表达到主的datacontext相对参考,但第一个广告工作,而后者则.

你有任何想法如何调查吗?

<DataGrid  x:Name="DataGrid" AutoGenerateColumns="False" ItemsSource="{Binding Table}"  >
    <DataGrid.Columns>
            <DataGridComboBoxColumn  Header="Type"   >
                <DataGridComboBoxColumn.ItemsSource>
                    <Binding Path="DataContext.GetColumnTypes"   RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" />
                </DataGridComboBoxColumn.ItemsSource>
            </DataGridComboBoxColumn>
    </DataGrid.Columns>
</DataGrid>
<ComboBox Grid.Row="1">
    <ComboBox.ItemsSource>
        <Binding Path="DataContext.GetColumnTypes"   RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" />
    </ComboBox.ItemsSource>
</ComboBox>
Run Code Online (Sandbox Code Playgroud)

System.Windows.Data错误:4:无法找到绑定源,引用'RelativeSource FindAncestor,AncestorType ='System.Windows.Controls.UserControl',AncestorLevel ='1''.BindingExpression:路径= DataContext.GetColumnTypes; 的DataItem = NULL; target元素是'DataGridComboBoxColumn'(HashCode = 53813616); target属性是'ItemsSource'(输入'IEnumerable')

wpf xaml

4
推荐指数
1
解决办法
6981
查看次数

scala中的异步:宏尚未扩展

我不确定为什么这个简单的代码会导致错误:

object Main {

  def main(args: Array[String]) {
    val userInterrupted: Future[String] = async {
      var inp =   await { Future.userInput("")}
      "You entered... " + inp
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

错误消息:

[error] /Users/reactive programming coursera/nodescala/src/main/scala/nodescala/Main.scala:18: macro has not been expanded
[error]     val userInterrupted: Future[String] = async {
[error]                                           ^
[error] one error found
[error] (assignment/compile:compile) Compilation failed
Run Code Online (Sandbox Code Playgroud)

macros asynchronous scala

4
推荐指数
1
解决办法
1439
查看次数

fsharp中参数和接口继承的缺陷

有什么理由说KO不起作用?

  type IBase = 
      abstract member test : (unit * unit) -> unit

  type OK() = 
      interface IBase with

        member x.test ((titi,tata)) = () //OK

  type KO() = 
      interface IBase with

        member x.test (titi,tata) = () //fail : This override takes a different number of arguments to the corresponding abstract member    
Run Code Online (Sandbox Code Playgroud)

f# unit-type

4
推荐指数
2
解决办法
291
查看次数

通过参数名称和模式匹配在ocaml中绑定

在OCaml中,我怎样才能:

  • 模式匹配参数
  • 并将不匹配的参数绑定到名称?

在haskell它就像

f arg@{..} = some code using both arg and its fields
Run Code Online (Sandbox Code Playgroud)

ocaml pattern-matching

4
推荐指数
1
解决办法
49
查看次数

OCaml 中的值级模块打包和函子

我想知道为什么一个例子失败了,而另一个例子却失败了。

  (* this fails  *)
  (* (l fails to type check)
     This expression has type 'a but an expression was expected of type
     (module M.TFixU)
     The module type M.TFixU would escape its scope
  *)
  let foldList1 (type ar) algr l =
    let module M = FixT (ListIntF) in
    let (module LU : M.TFixU) = l in
    assert false

  (* but this works  *)
  let foldList2 (type ar) algr l =
    let (module LU : FixT(ListIntF).TFixU) = l in
    assert false …
Run Code Online (Sandbox Code Playgroud)

ocaml module

4
推荐指数
1
解决办法
74
查看次数

为什么 `nix flake show` 构建 ghc?

如果我查看M1 计算机的haskell.nix flake 提供的输出,它会开始构建 ghc-8.8.4 等。

\n
\xe2\x9d\xaf nix flake show github:input-output-hk/haskell.nix\ngithub:input-output-hk/haskell.nix/1b54ea01568299a0eda578ae9395e20d5c699ee1\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80checks\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80aarch64-darwin\ntrace: haskell-nix.haskellLib.cleanGit: /nix/store/jmx2m0ldgrjq7p3gb4yyca47nvbvspfl-source does not seem to be a git repository,\nassuming it is a clean checkout.\ntrace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!\ntrace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!\ntrace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!\ntrace: WARNING: No materialized …
Run Code Online (Sandbox Code Playgroud)

haskell nix nix-flake

4
推荐指数
1
解决办法
430
查看次数

Haskell 中的不饱和类型族

是否有任何版本的 GHC 支持该扩展UnsaturatedTypeFamilies

搜索9.2.1手册显示没有条目

一般来说,如何找到哪个 GHC 版本支持扩展?

haskell

4
推荐指数
1
解决办法
108
查看次数

在 repl 中的 Nix 中急切地打印

文档flake-utils有以下示例作为文档

eachSystem [ system.x86_64-linux ] (system: { hello = 42; })
# => { hello = { x86_64-linux = 42; }; }
eachSystem allSystems (system: { hello = 42; })
# => {
   hello.aarch64-darwin = 42,
   hello.aarch64-genode = 42,
   hello.aarch64-linux = 42,
   ...
   hello.x86_64-redox = 42,
   hello.x86_64-solaris = 42,
   hello.x86_64-windows = 42
}
Run Code Online (Sandbox Code Playgroud)

据我所知,必须

> nix repl
nix-repl> e = builtins.getFlake("github:numtide/flake-utils")
nix-repl> with e.outputs.lib;
          eachSystem [ system.x86_64-linux ] (system: { hello = 42; })
Run Code Online (Sandbox Code Playgroud)

获取结果值(也可以执行:a e.outputs.lib“将结果集中的属性添加到范围”而不使用该 …

nixos nix

4
推荐指数
1
解决办法
443
查看次数

为什么(dictionary.keys()).sort()在python中不起作用?

我是Python的新手,无法理解为什么这样的东西不起作用.我也找不到其他地方提出的问题.

toto = {'a':1, 'c':2 , 'b':3}
toto.keys().sort()           #does not work (yields none)
(toto.keys()).sort()         #does not work (yields none)
eval('toto.keys()').sort()   #does not work (yields none)
Run Code Online (Sandbox Code Playgroud)

然而,如果我检查类型,我看到我在列表上调用sort(),那么问题是什么..

toto.keys().__class__     # yields <type 'list'>
Run Code Online (Sandbox Code Playgroud)

我有这个工作的唯一方法是添加一些丑陋的临时变量

temp = toto.keys()
temp.sort()
Run Code Online (Sandbox Code Playgroud)

我在这里缺少什么,必须有一个更好的方法来做到这一点.

python sorting

3
推荐指数
2
解决办法
3156
查看次数