小编nic*_*las的帖子

重新加载类型提供者

我正在使用fsharp powerpack示例中提供的MiniCSVTypeProvider.

不幸的是,它认为提供的值是浮动的,而我的是各种(变化的)格式.因此,我重写了MiniCsvType提供程序,以便始终提供字符串,将解析工作留给调用者.

但由于某些奇怪的原因,在解除引用旧DLL并包含对新DLL的引用之后,它使用旧类型提供程序继续提供浮动.我不得不更改程序集和类的名称以使VS刷新它.

有没有其他方法可以撤销/重置以前的类型提供程序,以便VS将更改考虑在内?

f# visual-studio type-providers

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

fsharp中的自定义比较和相等

似乎必须重写Equality才能覆盖比较.

这是真的吗?有什么理由让我失踪吗?

comparison f#

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

loadFromRemoteSources enabled ="true"// XAML设计师// VS 11 beta和2012 RC

由此我经常被蜇,当然也总是在最糟糕的时刻.当我编辑xaml文件时,我收到此错误

(System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.)
Run Code Online (Sandbox Code Playgroud)

我在devenv.exe.config中添加了推荐的元素

<configuration>
  <runtime>
    <loadFromRemoteSources enabled="true" />
  </runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)

应该摆脱它,但对我不起作用.我应该在其他地方添加吗?系统如何首先知道这是从互联网上下载的?我该怎样摆脱那个警告?

wpf dll cas visual-studio

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

系统范围的绑定重定向为F#4.0.0.0到4.3.0.0

我有一些xUnit测试失败的常见

Could not load file or assembly 'FSharp.Core, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 
The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)

为了执行机器范围的重定向,我添加到文件中

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config 

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a"
                        culture="neutral"/>
      <bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)

你有更好的方法来处理4.0/4.3问题吗?

.net f# assembly-binding-redirect

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

从Hoogle命令行访问函数的文档

Hoogle网站上搜索功能时,可以看到与其相关的文档,例如:

mod :: a -> a -> a            infixl 7

    integer modulus, satisfying

    (x `div` y)*y + (x `mod` y) == x
Run Code Online (Sandbox Code Playgroud)

Hoogle也作为命令行可执行文件存在.据我所知,它只显示功能的签名:

~ ??? hoogle --info Prelude.mod
Prelude mod :: Integral a => a -> a -> a

From package base
mod :: Integral a => a -> a -> a
Run Code Online (Sandbox Code Playgroud)

有没有办法通过命令行获取相关文档,如在线版本?

haskell hoogle

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

免费monad和免费操作

来形容免费单子的一种方式是说,这是一个最初在endofunctors的类别(某些类别的幺C),其对象是endofunctors从CC,箭头是它们之间的自然变换.如果我们CHask的是endofunctor所谓Functor在Haskell,这是由函子* -> *,其中*代表的对象Hask

通过initiality,从endofunctor任何地图t到幺mEnd(Hask)诱导从地图Free tm.

所述否则,从算符任何天然转化t到单子m诱导从天然转化Free tm

我原以为能够编写一个函数

free :: (Functor t, Monad m) => (? a. t a ? m a) ? (? a. Free t a ? m a)
free f (Pure  a) = return a
free f (Free (tfta :: t …
Run Code Online (Sandbox Code Playgroud)

monads haskell category-theory free-monad

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

回文和丹维对直接风格的评论

这是一些代码,以“直接样式”确定列表在 n+1 比较中是否为回文

pal_d1 :: Eq a => [a] -> Bool
pal_d1 l = let (r,_) = walk l l in r
        where walk l           [] = (True,l) 
              walk l       (_:[]) = (True,tail l)
              walk (x:l) (_:_:xs) = let (r, y:ys) = walk l xs
                                    in (r && x == y, ys)      
Run Code Online (Sandbox Code Playgroud)

可以在几个例子上进行测试

-- >>> pal_d1 [1,2,1]
-- True

-- >>> pal_d1 [1,2,2,1]
-- True

-- >>> pal_d1 [1,2,3,4,2,1]
-- False
Run Code Online (Sandbox Code Playgroud)

Danvy 在“ There and back again ”中声称没有控制运算符(就在 4.2 之前)没有直接的风格解决方案,因为在下面的 …

recursion continuations haskell callcc continuation-passing

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

GADT 的索引初始代数

Hinze在他的论文Generics for the Masses中回顾了数据类型的编码。

\n

从...开始Nat

\n
data Nat :: \xe2\x8b\x86 where \n   Zero :: Nat\n   Succ :: Nat \xe2\x86\x92 Nat\n
Run Code Online (Sandbox Code Playgroud)\n

NatF Nat -> Nat它可以被视为初始代数NatF a = 1 + a

\n

它的教会代表\xe2\x88\x80 x. ( NatF x \xe2\x86\x92 x ) \xe2\x86\x92 x是初始代数所赋予的普遍财产的见证

\n

因此他重新定义了一个等价的Nat

\n
newtype Nat = Nat{fold :: \xe2\x88\x80 nat . Algebra nat \xe2\x86\x92 nat } \ndata Algebra nat = With{\n  foldZero :: nat,\n  foldSucc :: nat \xe2\x86\x92 nat }\n …
Run Code Online (Sandbox Code Playgroud)

haskell types algebra algebraic-data-types category-theory

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

在C#中添加委托

如何在不使用+ =表示法的情况下向委托添加新函数?

我想知道如何从另一个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团队的一项设计决定,即不要过多地改变队列.

c# f# delegates

5
推荐指数
1
解决办法
308
查看次数

R类型提供者和Ggplot2

有人用过吗?我不介意看一个简短的例子来快速启动.

我可以运行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)

我正在阅读说明,但如果有人有一个方便的片段...

f# r type-providers

5
推荐指数
1
解决办法
3095
查看次数