小编Joh*_*aze的帖子

什么是Haskell的"火花"

我对"火花"的概念感到困惑

它是Haskell中的一个线程吗?或者是产生新线程的行为?

谢谢大家:

总而言之,spark不是线程,而是更多的计算单元(将它放在C#/ Java术语中的任务).所以这是实现任务并行性的Haskell方式.

parallel-processing multithreading haskell multicore

47
推荐指数
2
解决办法
7650
查看次数

monad在纯函数式编程中使用IO的替代方法是什么?

monad被描述为处理IO的haskell解决方案.我想知道是否有其他方法可以用纯函数式语言处理IO.

io monads functional-programming side-effects

34
推荐指数
6
解决办法
4467
查看次数

是什么让FSharpFunc <>比Func <>更快?

我很好奇为FSharpFunc <>所做的性能增强.事实上它不包含多个委托,因此在触发函数调用时不需要遍历所有引用吗?还要别的吗 ?

f# delegates

22
推荐指数
2
解决办法
2051
查看次数

当泛型参数来自多个程序集时,按名称加载泛型类型

我需要从它的全名创建一个类型Ex:"System.String"或"Tuple'2 [string,Mytype]".字符串中没有关于程序集的信息.这是代码的样子.

private static Type LoadType(string typeName)
{
    // try loading the type
    Type type = Type.GetType(typeName, false);

    if (type != null)
        return type;

    // if the loading was not successfull iterate all the referenced assemblies and try to load the type.
    Assembly asm = Assembly.GetEntryAssembly();
    AssemblyName[] referencedAssemblies = asm.GetReferencedAssemblies();
    foreach (AssemblyName referencedAssemblyName in referencedAssemblies)
    {
        type = referencedAssembly.GetType(typeName, false);
        if (type != null)
            return type;
    }
    throw new TypeLoadException(string.Format("Could not load the Type '{0}'",typeName));
}
Run Code Online (Sandbox Code Playgroud)

当类型不是通用的时,此方法有效.但是对于泛型类型,遍历程序集总是失败,因为没有程序集包含构建类型所需的所有定义.

有没有办法在调用GetTypes时为类型解析提供多个程序集?

.net c# reflection assemblies

6
推荐指数
2
解决办法
4393
查看次数

如何配置任务以在vscode中调用powershell脚本

我试图在visual studio代码中设置一个构建任务来调用用PowerShell编写的现有构建脚本.这是我如何设置我的构建任务

{
    "version": "0.1.0",
    "command": "powershell",
    "isShellCommand": true,
    "args": [   
        "-File ${cwd}/source/deployment/build.ps1",
        "-NoProfile",
        "-ExecutionPolicy Unrestricted"
    ],
    "taskSelector": "-task ",
    "showOutput": "always",
    "tasks": [
        {
            "taskName": "build",
            "showOutput": "always",
            "isBuildCommand": true
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

但这里是我运行任务时的输出

.:无法加载文件C:\ Users\chkeita\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1,因为在此系统上禁用了运行脚本.有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkID=135170上的 about_Execution_Policies .在行:1个字符:3 +.'C:\ Users\chkeita\Documents\WindowsPowerShell\Microsoft.PowerShell_ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:SecurityError:(:) [],PSSecurityException + FullyQualifiedErrorId :UnauthorizedAccess -File:术语"-File"未被识别为cmdlet,函数,脚本文件或可操作程序的名称.检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试.在行:1 char:1 + -File f:\ Dev\spf3/source/deployment/build.ps1 -NoProfile -executionpo ... + ~~~~~ + CategoryInfo:ObjectNotFound:( - File:String)[] ,CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException

我尝试重新排序参数并将它们合并在一个字符串中但没有任何成功

我错过了什么?有没有更好的方法在vscode中执行此操作

visual-studio-code

6
推荐指数
1
解决办法
4473
查看次数