小编Lyn*_*ite的帖子

Visual Studio任务列表

确定在VS中的列表听起来非常棒.但我不能让它发挥作用.(我正在使用VS2010 shell,也适用于VS2010并且无法使其工作.语言是F#,如果这很重要)

我的代码中有这样的东西:

let expStatus = ref AwaitingResult 

member takecontrol () =     
             assert (!expStatus<>NoneSubmitted); //UNDONE: This might be possible, and indeed legal, if it happens should wait for cancelation to happen then to hand over
             assert (!expStatus<>BeingWorkedOn); //UNDONE: This might be possible, and indeed legal, if it happens should wait for cancelation to happen then to hand over
             //startThread "run" <| 
             this.RunExp () //Get to work    
Run Code Online (Sandbox Code Playgroud)

UNDONE是我设置中的标志.TODO也不起作用

有任何想法吗?

f# tasklist visual-studio-2010 visual-studio

2
推荐指数
1
解决办法
526
查看次数

C++循环声明

我的主要(全局)标题中的类delaractions中有几个循环声明的例子.

#include <cstdlib>
#include <iostream>

using namespace std;


enum piece_t {BLACK, WHITE, EMPTY, WALL}; //wall is area out side of board (board array is 21x21 but only 19x19 is playable)
enum dir_t {ABOVE,BELOW,LEFT, RIGHT}; //shall i overload ! or - operatior? !LEFT==RIGHT?


struct nextPoint_t  //should be implimented with references, but need to practice pointer
{ 
  point_t* above;
  point_t* below;
  point_t* left;
  point_t* right;

};




class point_t
{
 private:
  piece_t mType; //what sort of point this is
  int mLiberties;
  nextPoint_t  mAdjacent; …
Run Code Online (Sandbox Code Playgroud)

c++

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

.net断言显示条件失败

好吧,我已经习惯了旧的C断言,当它们失败时,它们会输出它们失败的条件,以及它所在的线路.(与预处理器一起使用).

现在我用F#编程(一种.net语言),代码充满了断言.(尝试防御性地编程).我的资产显示了一个带调用堆栈的弹出窗口.根据文档,也可以传递断言字符串,以便在失败时显示.所以我可以通过我的条件的字符串副本.例如:

assert (x=true, "x=true")
Run Code Online (Sandbox Code Playgroud)

但这违反了复制(避免)委托人.

如果我后来决定改变我想要断言的东西.(也许我意识到当我应该断言它是真的时我声称某些东西是假的)然后我必须在两个地方更改代码,否则消息将与我实际检查的内容不匹配.如果我忘记了事情可能会让人感到困惑.

这通常是如何处理的?

.net f# assert visual-studio-2010

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

可以要求Julia命名参数出现吗?

在Ruby中,我可以要求参数(1)出现,(2)有参数名称:

>> def f(x:)
>>   x + 1
>> end

>> f()
ArgumentError: missing keyword: x 
>> f(2)
ArgumentError: wrong number of arguments (given 1, expected 0)
>> f(x:7)
=> 8
Run Code Online (Sandbox Code Playgroud)

也就是说,我必须传递参数,并且必须提供相关的参数名称.

我可以在Python中做同样的事情:

>>> def f(*, x):
...   return x + 1
... 
>>> f()
TypeError: f() missing 1 required keyword-only argument: 'x'
>>> f(3)
TypeError: f() takes 0 positional arguments but 1 was given
>>> f(x=7)
8
Run Code Online (Sandbox Code Playgroud)

而且,为了更好的衡量,即使是Swift也可以这样做:

1> func f(x: Int) -> …
Run Code Online (Sandbox Code Playgroud)

parameters keyword-argument julia

1
推荐指数
2
解决办法
204
查看次数

如何在命令行中执行Julia代码?

我最近在Julia转移了我的代码.我想知道如何在命令行中执行Julia代码?

我知道Julia代码可以通过运行一次来​​编译.

但问题是我需要为集群上的模拟模型进行参数扫描,在那里我只能使用命令行 - 而不是REPL.

在群集上运行模拟复制的最佳实践是什么?

julia

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

我怎么做朱莉娅的价值派遣?

我听说过朱莉娅已经发布了符号的值,而且我也使用了todo Val{:MySymbol}.

但这似乎不起作用:

julia> foo(x) = "other"
foo (generic function with 1 method)

julia> foo(x::Val{:zinger}) = "It was zinger"
foo (generic function with 2 methods)

julia> foo(:zinger)
"other"
Run Code Online (Sandbox Code Playgroud)

为什么不输出"它是zinger"?

symbols dispatch julia

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

如何可视地查看配置文件信息?

我发现纯文本配置文件信息很难阅读。

首先,我尝试使用ProfileView.jl。但是我在安装它时遇到了麻烦。
人们通常使用其他方法来可视地查看此信息吗?

julia

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

是 Haskell 的美元 $ 运算符,还是 F# 的反向管道 &lt;| 同样的想法?

自从我使用 F# 已经好几年了,现在我正在尝试学习一些 Haskell,并找出我可以转移的想法。

f# haskell

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

Julia语言中的Generic Float类型?

我的问题很简单,Float朱莉娅有一个通用的类型吗?例如Integer,对于s 的情况,可以简单地编写Int,并且将Int32在32位系统或Int6464位系统中进行转换.但是对于Floats,请参阅下面的示例函数:

function bb(n)
    b = Array{Float64}(n) 
    b[1] = 0.9999
    for i = 2:n
        @inbounds b[i] = b[i-1] * 0.9999
    end    
    println(b[n])
end

bb(10^3)
@time bb(10^3)
@time bb(10^8)
Run Code Online (Sandbox Code Playgroud)

它提供以下时序结果以及总内存分配:

0.9048328935585562
0.9048328935585562
  0.000100 seconds (135 allocations: 15.750 KB)
2.4703e-320
  3.230642 seconds (14 allocations: 762.940 MB, 1.51% gc time)
Run Code Online (Sandbox Code Playgroud)

现在将第一行更改为b = Array{AbstractFloat}(n)并查看可笑的巨大时序和内存分配:

0.9048328935585562
0.9048328935585562
  0.003564 seconds (2.13 k allocations: 46.953 KB)
2.4703e-320
  351.068176 seconds (200.00 M allocations: 3.725 …
Run Code Online (Sandbox Code Playgroud)

types julia

0
推荐指数
1
解决办法
436
查看次数