这是一个来自A Visual Git Reference的捕获,它解释了rebase的想法.
http://a.imageshack.us/img339/4264/screenshot20100903at102.png
我的理解如下.
Lisp的APPLY用于调用存储在列表中的计算参数的函数.(从Rainer的注释修改)
例如,以下代码更改(列表1 2 3)到(+ 1 2 3).
(apply #'+ '(1 2 3))
但是,Python的应用会执行Lisp的funcall所做的工作,除了一些细微的差别(输入以元组/列表的形式给出)
(defun add (x y) (+ x y)) (funcall #'add 1 2) or (funcall #'(lambda (x y) (+ x y)) 10 2)
apply(lambda x,y : x+y, [1,2])
你怎么看?Lisp的funcall和Python的应用之间是否存在更多差异?
我有以下IronPython代码.
class Hello:
def __init__(self):
pass
def add(self, x, y):
return (x+y)
Run Code Online (Sandbox Code Playgroud)
我可以使用以下C#代码来使用IronPython代码.
static void Main()
{
string source = GetSourceCode("ipyth.py");
Engine engine = new Engine(source);
ObjectOperations ops = engine._engine.Operations;
bool result = engine.Execute();
if (!result)
{
Console.WriteLine("Executing Python code failed!");
}
else
{
object klass = engine._scope.GetVariable("Hello");
object instance = ops.Invoke(klass);
object method = ops.GetMember(instance, "add");
int res = (int) ops.Invoke(method, 10, 20);
Console.WriteLine(res);
}
Console.WriteLine("Press any key to exit.");
Console.ReadLine();
}
Run Code Online (Sandbox Code Playgroud)
我可以使用动态DLR使这段代码更简单吗?
该IronPython的行动中书有在<15.4.4动态对象进行交互的未来>关于它的简单的解释,但我无法找到一些例子.
我附上程序的源/批处理文件. Program.cs …
书CLR通过C#3解释了有关在第35页默认的全局CSC.RSP文件是什么在单相当于RSP文件?
我在mono目录中搜索了一下
/Library/Frameworks/Mono.framework/Versions/2.8/lib/mono/4.0/xbuild.rsp其中没有任何东西.
我有以下C++代码来制作DLL(Visual Studio 2010).
class Shape {
public:
Shape() {
nshapes++;
}
virtual ~Shape() {
nshapes--;
};
double x, y;
void move(double dx, double dy);
virtual double area(void) = 0;
virtual double perimeter(void) = 0;
static int nshapes;
};
class __declspec(dllexport) Circle : public Shape {
private:
double radius;
public:
Circle(double r) : radius(r) { };
virtual double area(void);
virtual double perimeter(void);
};
class __declspec(dllexport) Square : public Shape {
private:
double width;
public:
Square(double w) : width(w) { };
virtual …Run Code Online (Sandbox Code Playgroud) 这篇文章有以下代码.
Process p = new Process();
StringBuilder sb = new StringBuilder("/COVERAGE ");
sb.Append(exeFileName);
p.StartInfo.FileName = "vsinstr.exe";
p.StartInfo.Arguments = sb.ToString();
p.Start();
p.WaitForExit();
// Look at return code – 0 for success
Run Code Online (Sandbox Code Playgroud)
评论说我需要检查返回代码,但p.WaitForExit()不返回任何内容.
我需要解析用":"分隔的字符串来逐个处理内容.我可以用Python实现这个函数,如下所示:
st = "a:b:c"
h = st.split(":")
for item in h:
print item
Run Code Online (Sandbox Code Playgroud)
我怎么能用C#做同样的事情?
为了打印出文件中的内容,我有以下代码.
FILE *fp = fopen(cString, "w+");
NSString* message = [NSString stringWithFormat:@":SLEEP: %@:%@\n", ...];
char* cMessage = [message UTF8String]; <-- warning
fprintf(fp, cMessage); <-- warning
fclose(fp);
Run Code Online (Sandbox Code Playgroud)
但是,我Initialization discards qualifiers from pointer target type error进去了char* cMessage,并Format not a string literal and no format argument警告.
代码有什么问题?
我有一个HTML代码如下
<h2><a class="toc-backref" href="#id8">Debug</a></h2>
Run Code Online (Sandbox Code Playgroud)
如何将css格式应用于具有"toc-backref"类的内部<a>(内部<h2>)的Debug?
在C++中,我看到了这段代码.
public:
Ports& GetPorts();
const Ports& GetPorts() const;
Run Code Online (Sandbox Code Playgroud)
为什么有必要使用const的另一种方法?编译器如何决定调用哪个方法?
c# ×4
c++ ×2
python ×2
cocoa ×1
common-lisp ×1
const ×1
css ×1
git ×1
html ×1
ironpython ×1
lisp ×1
methods ×1
mono ×1
objective-c ×1
process ×1
python-2.x ×1
rebase ×1
split ×1
windows ×1