一些用于处理箭头的函数在成对使用时非常方便。但我不能理解这些函数的类型如何与一对函数相统一。一般来说,我发现箭头相关函数的类型非常令人困惑。
例如,我们有first :: a b c -> a (b, d) (c, d),这对我来说意义不大。但是它可以用来,比方说,增加一对中的第一个数字:
Prelude Control.Arrow> :t first (+1)
first (+1) :: (Num b) => (b, d) -> (b, d)
和
Prelude Control.Arrow> :t (&&&)
(&&&am
我下载了。我正在尝试交叉编译它,以便ARM(PandaBoard)运行精简版本的linux。
在配置的初始设置中,我尝试
Shell$ ./configure --host=ARM
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking for correct TEA configuration... ok (TEA 3.9)
代码:
s = input("Enter a String : \n")
print("The Entered String is : " + s)
print("The Length of Entered String is : " + str(len(s)))
输出:
┌─[jaysmito@parrot]─[~/Desktop]
└──╼ $python try.py
Enter a String :
hello
The Entered String is : hello
The Length of Entered String is :
当我在Linux上运行Db2 CLP (命令行处理器)并保持在CLP中时,箭头键不能像预期的那样工作。
例如:不是向我显示我执行的前面的命令,而是按下向上箭头生成:^[A并按左箭头生成:^[[D.
见下文:
[db2inst1@willow ~]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 11.5.0.0
You can issue database manager commands and SQL statements from the command
prompt.
在linux中,当我尝试为input()函数输入数据时,箭头键不起作用。我得到转义字符。见下文(当我按下向左箭头键时)。
dp@hp:~$ python3 -c "x = input('enter a number '); print(x)"
enter a number 123^[[D^[[D
我已经安装了readline (我可以在python shell中导入它)。箭头键在交互式解释器中工作得很好,但在上面的情况下就不行了(或者当我从脚本执行input()时)。
可能的原因是什么?
我试图访问上一个堆栈中的一个变量,它在Linux中给了我以下错误:
.... terminated by signal SIGSEGV (Address boundary error
然而,在2014年的CS61C讲座中,产出如下:
3
Something Random
在那台机器和我的Linux之间,它是怎么工作的?
为什么它要打印3 first time而不打印second time呢?如果printf不使用这个插槽来做其他事情,那么的行为也应该第二次发生--不是吗?
以下是代码:
#include<stdio.h>
int *ptr() {