2012年1月31日
摘要: Table6.1.Selected Numeric TypesTypeDescriptionDoubleDouble-precision floating point. A common choice for floating-point data.FloatSingle-precision floating point. Often used when interfacing with C.IntFixed-precision signed integer; minimum range [-2^29..2^29-1]. Commonly used.Int88-bit signed integ 阅读全文
posted @ 2012-01-31 15:40 江振 阅读(1210) 评论(0) 推荐(0)
摘要: 求一个数的因子的数量。X=a^n*b^m*c^p will have (n + 1)(m + 1)(p + 1) factors.//abc都是质因子28=2^2*7 will have 3*2 = 6 factors 因为:28的质因子是 2 2 7;28的所有因子必是由这些质因子构成;构造这些因子时:2可以取 0 、1、 2 个。7可以取0 、1 个;所以28因子的数量是:3×2=6 。http://mathforum.org/library/drmath/view/55843.htmlhttp://www.cnblogs.com/zhouyinhui/archive/2011/ 阅读全文
posted @ 2012-01-31 00:40 江振 阅读(289) 评论(0) 推荐(0)
  2012年1月30日
摘要: In the 2020 grid below, four numbers along a diagonal line have been marked in red.08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 0849 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 0081 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 6552 70 95 23 04 60 11 42 69 24 68 56 01 3 阅读全文
posted @ 2012-01-30 13:38 江振 阅读(145) 评论(0) 推荐(0)
  2012年1月29日
摘要: Sieve of Eratosthenesis a simple, ancientalgorithmfor finding allprime numbersup to any given limit.///SieveofEratosthenes///http://upload.wikimedia.org/wikipedia/commons/b/b9/Sieve_of_Eratosthenes_animation.gif///内部使用byte数组存放标志位,所以不适合非常大的素数范围。视内存限制。letPrimesBelowSOEx=letmutableret=[]letflagarr=Arr. 阅读全文
posted @ 2012-01-29 16:07 江振 阅读(188) 评论(0) 推荐(0)
  2012年1月28日
摘要: 5欧几里德求最小公约数法f#实现:///Euclideanalgorithm///http://en.wikipedia.org/wiki/Euclidean_algorithm///求AB的最大公约数///使用辗转相减法///原始的欧几里算法是:///设C为最大公约数///A=aCB=bC///gcd(A,B)=>gcd(A-B,B)[a>b]及gcd((a-b)C,B)不断的用大的减去小的。直到a-b=1那么就得到C了letrecgcdab=matchawith|xwhenx=0I->b|_->gcd(b%a)a有了最小公约数最小公倍数就简单了letlcmab=a* 阅读全文
posted @ 2012-01-28 21:03 江振 阅读(243) 评论(0) 推荐(0)
  2012年1月13日
摘要: FsLex FsYacc微软本身也提供了一个项目模板。但是这个项目模板是lex和yacc文件均包含。我想只适用lex,但是如果每次使用命令行也觉得不够方便,于是还是研究了一番MsBuild的使用。使用msbuild hellp.fsproj /v:d 可以查看整个msbuild的流程,非常白盒。hello.fsproj文件:<?xml version="1.0" encoding="utf-8"?><Project ToolsVersion="4.0" DefaultTargets="MyBuild&quo 阅读全文
posted @ 2012-01-13 15:10 江振 阅读(380) 评论(0) 推荐(0)
  2011年10月20日
摘要: F#// The following code demonstrates the use of reference// cells to enable partially applied arguments to be changed// by later code.let increment1 delta number = number + deltalet mutable myMutableIncrement = 10// Closures created by partial application and literals.let incrementBy1 = increment1 1 阅读全文
posted @ 2011-10-20 13:14 江振 阅读(220) 评论(0) 推荐(0)
  2011年10月3日
摘要: Why Haskell matters(Redirected fromWhy Haskell Matters)Contents[hide]1What are functional programming languages?1.1The level of abstraction1.2Functions and side-effects in functional languages1.3Conclusion2What can Haskell offer the programmer?2.1Purity2.2Laziness2.3Strong typing2.4Elegance2.5Haskel 阅读全文
posted @ 2011-10-03 11:49 江振 阅读(496) 评论(0) 推荐(0)
  2011年8月31日
摘要: 在emacs 的bin 目录运行 addpm.exe然后在用户目录(我的是administrator)下面就可以看到.emacs.d 的文件夹在里面新建init.el 文件好了,接下来按部就班了。路径:emacs mode :http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs得到sandos的提示:http://stackoverflow.com/questions/41300/emacs-in-windows接着找到Q A(最终在这里学会的):http://www.gnu.org/software/emacs/windows/I 阅读全文
posted @ 2011-08-31 13:28 江振 阅读(1469) 评论(0) 推荐(0)
摘要: 项目灵感之视频网站的广告实在烦人,写个闭嘴程序。 阅读全文
posted @ 2011-08-31 00:12 江振 阅读(165) 评论(0) 推荐(0)