由于最新的Ubuntu 13.04没有haskell-plattform,我只下载了GHCi并且直到现在都没有问题.
但现在我想和monad一起工作.用它们导入它们
import Control.Monad.State
Run Code Online (Sandbox Code Playgroud)
例如不起作用.错误消息:
Could not find module `Control.Monad.State'
Perhaps you meant
Control.Monad.ST (from base)
Control.Monad.ST.Safe (from base)
Control.Monad.Fix (from base)
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
Run Code Online (Sandbox Code Playgroud)
我该如何手动下载它们,还是有完全不同的问题?
经过漫长的一天编码,我意外地写道
cout << "some text" << cout;
Run Code Online (Sandbox Code Playgroud)
代替
cout << "some text" << endl;
Run Code Online (Sandbox Code Playgroud)
现在它打印出一个内存地址.它指向什么?
我正在寻找一种永久性地突出显示Emacs中所选文本的方法,就像使用PDF中的标记一样.我正在使用组织模式.
我试着在Google上搜索,但我很惊讶我没有找到任何东西.
当我尝试通过变量索引访问列表元素时,我得到一个错误:
Prelude> let x = 0
Prelude> let y = [1,2,3]
Prelude> y !! x
<interactive>:18:6:
Couldn't match expected type `Int' with actual type `Integer'
In the second argument of `(!!)', namely `x'
In the expression: y !! x
In an equation for `it': it = y !! x
Run Code Online (Sandbox Code Playgroud)
问题似乎是0的类型是Num而x的类型是Integer,但我该如何解决这个问题呢?我试图谷歌问题,但没有成功.
我需要在字符串中的每个给定字符后插入一个空格.
例如 "abc.def..."
需要成为 "abc. def. . . "
所以在这种情况下,给定的字符是点.
我在谷歌上搜索没有回答这个问题
我真的应该去获得一些严肃的正则表达式知识.
编辑:------------------------------------------------ ----------
String test = "0:;1:;";
test.replaceAll( "\\:", ": " );
System.out.println(test);
// output: 0:;1:;
// so didnt do anything
Run Code Online (Sandbox Code Playgroud)
解决方案:------------------------------------------------ -------
String test = "0:;1:;";
**test =** test.replaceAll( "\\:", ": " );
System.out.println(test);
Run Code Online (Sandbox Code Playgroud)