镜头似乎没有任何缺点,同时具有优于标准Haskell的显着优势:是否有任何理由我不应该尽可能使用镜头?有性能考虑吗?另外,模板Haskell是否有任何重大开销?
我有vcvarsall.bat问题,所以我按照这里的说明如何在使用Pip安装Python包时使用MinGW的gcc编译器?.
现在,pip install lxml在Windows 7上使用Python 3.2.2时,我收到以下错误:
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python32\include -IC:\Pytho
n32\PC -c src/lxml/lxml.etree.c -o build\temp.win32-3.2\Release\src\lxml\lxml.et
ree.o -w
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
整个输出:
C:\Python32\Scripts>pip-3.2.exe install lxml
Downloading/unpacking lxml
Real name of requirement lxml is lxml
Downloading lxml-2.3.3.tar.gz (3.1Mb): 3.1Mb downloaded
Running setup.py egg_info for package lxml
Building lxml version 2.3.3.
Building without Cython.
ERROR: b"'xslt-config' is not recognized as an internal or external …Run Code Online (Sandbox Code Playgroud) #include <cstdio>
class baseclass
{
};
class derclass : public baseclass
{
public:
derclass(char* str)
{
mystr = str;
}
char* mystr;
};
baseclass* basec;
static void dostuff()
{
basec = (baseclass*)&derclass("wtf");
}
int main()
{
dostuff();
__asm // Added this after the answer found, it makes it fail
{
push 1
push 1
push 1
push 1
push 1
push 1
push 1
push 1
push 1
push 1
}
printf("%s", ((derclass*)basec)->mystr);
}
Run Code Online (Sandbox Code Playgroud) 试图学习如何使用Data.Binary并在此处遇到障碍:
http://www.haskell.org/haskellwiki/Serialisation_and_compression_with_Data_Binary
D:\Projects\haskell\serialize\ex1.hs:114:26:
Couldn't match expected type `bytestring-0.9.1.10:Data.ByteString.Lazy.Internal.ByteString'
with actual type `L.ByteString'
Expected type: Int
-> bytestring-0.9.1.10:Data.ByteString.Lazy.Internal.ByteString
Actual type: Int -> L.ByteString
In the return type of a call of `toByteString'
In the second argument of `(.)', namely `toByteString f'
D:\Projects\haskell\serialize\ex1.hs:122:21:
Couldn't match expected type `L.ByteString'
with actual type `bytestring-0.9.1.10:Data.ByteString.Lazy.Internal.ByteString'
In the first argument of `L.length', namely `fs'
In the first argument of `(+)', namely `L.length fs'
In the first argument of `(==)', namely `L.length fs + L.length is'
[Finished]
Run Code Online (Sandbox Code Playgroud) #include <iostream>
using namespace std;
int main() {
float result = 50.0f;
float multiplier = 0.5f;
float fixed_multiplier = 1.0f - multiplier * 0.001f;
for (int i = 0; i < 1000; ++i) {
result *= fixed_multiplier;
}
cout << result << endl; // 30.322 -- want approximately 25
}
Run Code Online (Sandbox Code Playgroud)
在1000次迭代之后,我想result等于multiplier*result(result==25).如何找到修改乘数(in fixed_multiplier)以获得所需结果所需的内容?
var = 8
itr 1:
var == 8 (8 * 1)
itr 2:
var == 24 (8 * 3)
itr 3:
var == 48 (8 * 6)
itr 4:
var == 80 (8 * 10)
itr 5:
var == 120 (8 * 15)
Run Code Online (Sandbox Code Playgroud)
模式:( var*(最后乘数+当前迭代))
基本上我想得到公式(itr)的结果,而不必迭代到itr.
c++ ×2
haskell ×2
math ×2
analytical ×1
easy-install ×1
iteration ×1
lenses ×1
pip ×1
python ×1
python-3.x ×1
recursion ×1