是什么让第一次实施KO?
type IToto =
abstract Toto : unit -> unit
{ new IToto with
member this.Toto =
fun () -> () }
{ new IToto with
member this.Toto () = () }
Run Code Online (Sandbox Code Playgroud) 在XAML编辑器中,我可以将命名空间设置为C#项目中包含的Viewmodel
namespace ViewModelDB
{
public class DependencyViewModel : IViewModelDB
{
public string Message { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
在我的xaml
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ViewModelDB="clr-namespace:ViewModelDB;assembly=ViewModelDB"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
>
<UserControl.DataContext>
<ViewModelDB:DependencyViewModel/>
</UserControl.DataContext>
<Grid>
<TextBlock Text="{Binding Message}"/>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
然后识别绑定"消息".
当我指向类似选区的F#名称空间时
namespace ModuleDBGraph
open Infrastructure
open Microsoft.Practices.Prism.Regions;
open Microsoft.Practices.Unity;
type IDependencyViewModel =
inherit IViewModel
abstract Message : string with get, set
type DependencyViewModel () =
interface IDependencyViewModel with
member val Message = "" with get, set
Run Code Online (Sandbox Code Playgroud)
然后我松开了对绑定消息的识别
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" …Run Code Online (Sandbox Code Playgroud) 如何在不使用+ =表示法的情况下向委托添加新函数?
我想知道如何从另一个CLR语言中做到这一点,即F#.(我知道有更好的方法来处理F#中的事件,但我很好奇..)
static int Square (int x) { return x * x; }
static int Cube(int x) { return x * x * x; }
delegate int Transformer (int x);
Transformer d = Square ;
d += Cube;
Run Code Online (Sandbox Code Playgroud)
编辑
正如丹尼尔在评论中所指出的那样,一个没有直接做到这一点的事实可能是dotnet团队的一项设计决定,即不要过多地改变队列.
有人用过吗?我不介意看一个简短的例子来快速启动.
我可以运行example.fsx脚本:acf函数副作用显示在图表上.
但我不知道如何出现ggplot图形.
open RProvider.ggplot2
open RProvider.utils
R.setwd @"C:/code/pp/Datasets/output/Kaggle/dontgetkicked"
let f = R.read_csv("measure_DNGtraining.csv")
R.qplot("erase_rate", "components",f)
Run Code Online (Sandbox Code Playgroud)
这产生了一个
val it : SymbolicExpression =
RDotNet.SymbolicExpression {Engine = RDotNet.REngine;
IsClosed = false;
IsInvalid = false;
IsProtected = true;
Type = List;}
Run Code Online (Sandbox Code Playgroud)
我正在阅读说明,但如果有人有一个方便的片段...
我不确定R中的承诺是做什么的
如果一个人跑
a = lapply(seq_len(2), function(n) { function() {n}})
b = lapply(seq_len(2), function(n) {n})
Run Code Online (Sandbox Code Playgroud)
我们可以看到
a[[1]]() # == 2
b[[1]] # == 1
Run Code Online (Sandbox Code Playgroud)
我理解R使用promise的对象并懒惰地在其环境中计算表达式,但我不明白为什么为每个函数创建的不同环境不会包含它们自己的n值.
[[1]]
function ()
{
n
}
<environment: 0x7f9b2416ad18>
[[2]]
function ()
{
n
}
<environment: 0x7f9b2416ab20>
as.list(environment(a[[1]]))
$n
[1] 2
as.list(environment(a[[2]]))
$n
[1] 2
Run Code Online (Sandbox Code Playgroud)
是否有可能以某种方式通过lapply函数修复语义?
lapply
function (X, FUN, ...)
{
FUN <- match.fun(FUN)
if (!is.vector(X) || is.object(X))
X <- as.list(X)
.Internal(lapply(X, FUN))
}
<bytecode: 0x7f9b25150f18>
<environment: namespace:base>
Run Code Online (Sandbox Code Playgroud)
PS:重新聚焦的问题
编辑:具体来说,是否可以编写一个 …
我不确定如何在定点之后派生出函数实例:
data FreeF f a next = PureF a | FreeF (f next) deriving (Functor)
data Mu f = In { out :: f ( Mu f ) }
newtype Free f a = Free( Mu (FreeF f a) )
instance Functor f => Functor (Free f) where
fmap h (Free (out -> PureF a)) = Free (In (PureF (h a)))
fmap h (Free (out -> FreeF fn)) = Free (In (fmap undefined undefined)) --stuck
Run Code Online (Sandbox Code Playgroud)
如果我修改Mu以接受额外的类型参数,我可以继续...直到...:
data Mu f a …Run Code Online (Sandbox Code Playgroud) 我不确定为什么这个简单的代码会导致错误:
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) 有什么理由说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) 如果我查看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) 文档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“将结果集中的属性添加到范围”而不使用该 …