
haskell
mjk
这个作者很懒,什么都没留下…
展开
-
用Haskell计算矩阵
a :: Matrixa = [[2.0, 3.0, 4.0], [5.0, 6.0, -1.0]]b :: Matrixb = [[1.0, 0.0], [1.0, 1.0], [0.0, -1.0]]matrixProduct :: Matrix -> Matrix -> MatrixmatrixProduct m p = [[ scalarProduct r c |转载 2009-03-29 15:11:00 · 3481 阅读 · 0 评论 -
这段代码处理排版比较乱的文本文件,但是我一直整理文件不成功,忘记从哪个大牛的网站上摘来的,抱歉!
module Main whereimport Data.Charimport Data.Listimport System.Environmentimport System.FilePathimport Text.Parsecimport Text.Parsec.StringparaBeginSpace :: IntparaBeginSpace = 2main :: IO转载 2011-11-10 08:31:33 · 912 阅读 · 1 评论 -
scheme
<br />(define)<br />(display)<br />(newline)<br />[]<br />lambda<br />let<br /> <br />原创 2011-05-30 20:56:00 · 478 阅读 · 0 评论 -
>> >>= do
<br />In general, use >> if the actions don’t return a value, >>= if you’ll be immediately passing that value into the next action, and do-notation otherwise.原创 2011-05-29 11:40:00 · 509 阅读 · 0 评论 -
Understanding Haskell Monads
<br />http://ertes.de/articles/monads.html<br /> Understanding Haskell Monads<br />Copyright © 2011 Ertugrul Söylemez<br />Version 1.04 (2011-04-20)<br />Haskell is a modern purely functional programming language, which is easy to learn, has a beautiful sy转载 2011-05-22 17:15:00 · 1667 阅读 · 0 评论 -
Paul Hudak谈Haskell
<br />http://www.infoq.com/cn/interviews/paul-hudak-haskell<br />原创 2010-10-20 13:17:00 · 1210 阅读 · 3 评论 -
Haskell:String和ByteString互相转换代码
<br /><br />toBS :: String ->BS.ByteString<br />toBS = BS.pack . map (fromIntegral . fromEnum)<br /> <br />fromBS :: BS.ByteString -> String<br />fromBS = map (toEnum . fromIntegral) . BS.unpack原创 2010-10-19 15:26:00 · 7074 阅读 · 1 评论 -
case x of是没有otherwise的
<br />module Main where<br />import System.Environment(getArgs)<br />import qualified Data.ByteString as B (readFile, writeFile, map)<br />main = do<br /> args <- getArgs<br /> case args of<br /> [from, out, direction] -> <br /> case direction of原创 2010-10-06 10:17:00 · 637 阅读 · 0 评论 -
case是可以嵌套case的
<br />module Main where<br />import System.Environment(getArgs)<br />import qualified Data.ByteString as B (readFile, writeFile, map)<br />main = do<br /> args <- getArgs<br /> case args of<br /> [from, out, direction] -> <br /> case direction of原创 2010-10-05 21:45:00 · 6288 阅读 · 0 评论 -
Haskell与范畴论
<br />http://www.yi-programmer.com/blog/2010-04-06_haskell_and_category_translate.html#id24<br /> <br /> 白菜 - 精确编程 HomeBlogComments豆瓣九点Haskell与范畴论<br />用haskell的概念解释范畴论。翻译自 wikibook : http://en.wikibooks.org/wiki/Haskell/Category_theory<br />目录范畴论简介范畴公理Ha转载 2010-09-16 19:49:00 · 2174 阅读 · 0 评论 -
Install gtk2hs on ubuntu
cabal install gtk2hs-buildtools<br />sudo cp ~/.cabal/bin/gtk2hsC2hs /usr/bin<br /><br />sudo cp ~/.cabal/bin/gtk2hsHookGenerator /usr/bin<br /><br />sudo cp ~/.cabal/bin/gtk2hsTypeGen /usr/bin<br /><br />cabal install gtk<br /><br />cd ~/.cabal/sh原创 2010-09-16 20:28:00 · 1234 阅读 · 0 评论 -
ubuntu install gtk2
<br />sudo aptitude install gnome-core-devel build-essential<br /> pkg-config --cflags --libs gtk+-2.0转载 2010-09-16 19:53:00 · 487 阅读 · 0 评论 -
Haskell 几乎无痛苦上手指
<br />http://blog.youkuaiyun.com/albert_lee/archive/2010/04/10/5469933.aspx<br /> <br />from albert_lee<br /> <br /> Haskell 几乎无痛苦上手指 收藏<br /> <br />趁着自己重装Linux 虚拟机的机会,把安装 haskell 的过程记录一下,顺便帮那些还犹豫徘徊在haskell门外的读者入门。基本概念:Haskell : <br />是一门通用函数式语言,几转载 2010-09-16 17:54:00 · 2595 阅读 · 0 评论 -
Installing the Haskell Platform in Ubuntu
<br />http://sporkcode.wordpress.com/2009/07/11/installing-the-haskell-platform-in-ubuntu/<br />Code. Randomness. Sporks.<br /> Installing the Haskell Platform in Ubuntu<br />with 11 comments<br />After my previous article about installing Haskell’s Caba转载 2010-09-12 13:21:00 · 917 阅读 · 0 评论 -
用haskell生成一个随机数的列表
import Random drawInt :: Int -> Int -> IO IntdrawInt x y = getStdRandom (randomR (x,y))random_list :: Int -> IO [Int]random_list 0 = return []random_list n = do a rest random_list(n-1))原创 2009-03-29 15:18:00 · 3015 阅读 · 0 评论 -
那些数相除可以得到π
import Numericmypi = [(x, y)|x原创 2009-03-29 15:15:00 · 1038 阅读 · 0 评论 -
一段Parsec CSV文件的haskell代码
from 《Real World Haskell》-- file: ch16/csv1.hsimport Text.ParserCombinators.Parsec{- A CSV file contains 0 or more lines, each of which is terminated by the end-of-line character (eol). -}csv转载 2011-11-10 08:28:00 · 929 阅读 · 0 评论