首页 \ 问答 \ 如何在vim中翻转窗口?(How to flip windows in vim? [duplicate])

如何在vim中翻转窗口?(How to flip windows in vim? [duplicate])

可能重复:
在Vim中快速从垂直分割切换到水平分割

如果我有2个水平拆分窗口,如何旋转它们以获得2个垂直分割窗口?

和如何切换缓冲区?


Possible Duplicate:
To switch from vertical split to horizontal split fast in Vim

If I have 2 horizontally split windows, how to rotate them to get 2 vertically split windows?

And how to switch buffers?


原文:https://stackoverflow.com/questions/6071266
更新时间:2022-02-21 17:02

最满意答案

那么,它们在“构造函数”这个词的任何正常用法中都不是真正的“构造函数”。

它们是可以转换为委托类型或表达式树类型的表达式 - 后者在处理进程外的LINQ时非常重要。

如果你真的问是否期望使用两个“等价”lambda表达式可以创建不平等的委托实例:是的,它是。 IIRC,C#语言规范甚至还声明这种情况。

但是,多次使用相同的lambda表达式不会总是创建不同的实例:

using System;

class Test
{
    static void Main(string[] args)
    {
        Action[] actions = new Action[2];
        for (int i = 0; i < 2; i++)
        {
            actions[i] = () => Console.WriteLine("Hello");
        }
        Console.WriteLine(actions[0] == actions[1]);
    }
}

在我的盒子上,它实际上打印了True - actions[0]actions[1]具有完全相同的值 - 它们指向相同的实例。 事实上,我们可以走得更远:

using System;

class Test
{
    static void Main(string[] args)
    {
        object x = CreateAction();
        object y = CreateAction();
        Console.WriteLine(x == y);
    }

    static Action CreateAction()
    {
        return () => Console.WriteLine("Hello");
    }
}

再次,这打印True不能保证,但在这里编译器实际上已经创建了一个静态字段来缓存第一次需要的委托 - 因为它没有捕获任何变量等。

基本上这是一个你不应该依赖的编译器实现细节。


Well, they're not really "constructors" in any of the normal uses of the word "constructor".

They're expressions which can be converted to delegate types or expression tree types - the latter being essential when it comes to out-of-process LINQ.

If you're really asking whether it's expected that using two "equivalent" lambda expressions can create unequal delegate instances: yes, it is. IIRC, the C# language specification even calls out that that's the case.

However, using the same lambda expression more than once won't always create different instances:

using System;

class Test
{
    static void Main(string[] args)
    {
        Action[] actions = new Action[2];
        for (int i = 0; i < 2; i++)
        {
            actions[i] = () => Console.WriteLine("Hello");
        }
        Console.WriteLine(actions[0] == actions[1]);
    }
}

On my box, that actually prints True - actions[0] and actions[1] have the exact same value - they refer to the same instance. Indeed, we can go further:

using System;

class Test
{
    static void Main(string[] args)
    {
        object x = CreateAction();
        object y = CreateAction();
        Console.WriteLine(x == y);
    }

    static Action CreateAction()
    {
        return () => Console.WriteLine("Hello");
    }
}

Again, this prints True. It's not guaranteed to, but here the compiler has actually created a static field to cache the delegate the first time it's required - because it doesn't capture any variables etc.

Basically this is a compiler implementation detail which you should not rely on.

相关问答

更多
  • 那么,它们在“构造函数”这个词的任何正常用法中都不是真正的“构造函数”。 它们是可以转换为委托类型或表达式树类型的表达式 - 后者在处理进程外的LINQ时非常重要。 如果你真的问是否期望使用两个“等价”lambda表达式可以创建不平等的委托实例:是的,它是。 IIRC,C#语言规范甚至还声明这种情况。 但是,多次使用相同的lambda表达式不会总是创建不同的实例: using System; class Test { static void Main(string[] args) { ...
  • 你在谈论lambda函数吗? 喜欢 lambda x: x**2 + 2*x - 5 那些事情其实是非常有用的。 Python支持一种称为函数式编程的编程风格,您可以将函数传递给其他函数来执行操作。 例: mult3 = filter(lambda x: x % 3 == 0, [1, 2, 3, 4, 5, 6, 7, 8, 9]) 将mult3设置为[3, 6, 9] mult3 [3, 6, 9] ,原始列表中的那些元素是3的倍数。这是较短的(可以争辩,更清晰) def filterfunc(x) ...
  • 在TypeScript中,接口可以有呼叫签名。 在你的例子中,你可以这样声明: interface Greeter { (message: string): void; } function sayHi(greeter: Greeter) { greeter('Hello!'); } sayHi((msg) => console.log(msg)); // msg is inferred as string In TypeScript, interfaces can have call ...
  • 如何将lambda代码映射到接口实现的确切决定留给实际的运行时环境。 原则上,实现相同原始接口的所有lambdas都可以像MethodHandleProxies一样共享一个运行时类。 对于特定的lambdas使用不同的类是由实际的LambdaMetafactory实现执行的优化 ,但不是旨在帮助调试或反射的功能。 因此,即使您在lambda接口实现的实际运行时类中找到更详细的信息,它将是当前使用的运行时环境的工件,可能在不同的实现或当前环境的其他版本中可用。 如果lambda是Serializable您可以 ...
  • 原因很简单: 如何编译得出它应该是Func ? 他简单不能! 假设你有自己的代理人: public delegate int F(int i); 编译器如何在Func和F之间进行选择? 这些是完全不同的类型,有两个共同点:有两个委托并具有相同的签名(一个参数和返回类型,都是int类型)。 所以编译器不能选择; 你将不得不这样做: var funs = Enumerable.Range(0, 10).Select>(x => y ...
  • 我在这看到两个真正的区别: 第一个是如何存储回调:fast-delegate或std :: function。 后者基于boost :: function,快速代理专门设计为优于那些。 但是,std :: function符合标准,而快速代理则不符合标准。 另一个不同之处在于您设置代码的方式,我在这里看到了lambdas的明显优势。 您可以将实际代码准确地写在重要的位置,您不需要定义仅用于特定目的的单独函数。 如果你想要原始速度 - 快速代表可能会赢(但你应该基准测试,如果这是一个参数),但如果你想要可读性 ...
  • 是的,那不是很漂亮......但你可以使用一个辅助方法,如下所示: public class StructInputValidator : InputValidator where T : struct { public StructInputValidator(TryParse parser, T? initialValue) : base(ToNullableTryParse(parser), initialValue) { } priva ...
  • 委托 - 它不是方法签名。 It is a type which encapsulates a method 。 因此委托声明应该有一个类似于它想要封装的方法的签名。 When to use Delegate - whenever you want to pass a method to another function. 欲了解更多信息,请参阅本文 。 兰姆达斯 - 写作一个匿名函数的简短手段和更具表现力的方式。 但还有更多。 lambda表达式也可以转换为表达式树。 欲了解更多,请参阅。 匿名功能 - ...
  • 我没有NUnit来验证,但可能是你需要显式地将Lambda强制转换为Delegate以强制适当的重载解析: Assert.That((Action)(()=>viewModel.SaveCommand_Exec(this, new ExecutedRoutedEventArgs())), Throws.Nothing); I don't have NUnit to verify but it could be that you need to explicitly cas ...
  • 这是你想要的吗?: Func a = p0 => p0 << 1; Func b = (p0, p1) => p0 + p1; Delegate da = a; Delegate db = b; var inner = da.Method.GetParameters().Length < db.Method.GetParameters().Length ? da : db; var outer = inner == da ? db : da; Func ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。