Rocaml lets you wrtie Ruby extension in Ocaml. It can be a relief to my project, I truely hope. We are using Ocaml with Rails by means of fork or socket and dealing with the format of communication between two sides is just boring.
Now let's have a look at how rocaml works. I'm gonna translate an e ...
In Don Syme's excellent book drafts of his upcoming book Expert F#, the following code is used to demonstrate the quickness and easiness of F# interactive development.
> let req = WebRequest.Create("http://www.microsoft.com");;
val req : WebRequest
> let resp = req.GetResponse();;
val resp ...
Born to be together,这句也是Apple以前iTune和iPod的广告词。不过这里是用来比喻两个语言特性:类型推断和命名参数。
自ML诞生的类型推断技术似乎随着C#3的宣传日渐进入主流视野,一些新语言如D,Scala也实现了所谓“局部类型推断”(只简化声明,但不推断函数接口)。类型推断简化了大量不必要的类型声明,使代码获得动态脚本语言一样的感观,同时有获得编译期的类型检查和运行时的性能。不过在可读性上或多或少有点影响,有几种解决办法:
1)添加注释,以后注释和代码的同步维护负担重,不理想。
2)添加类型声明,像Haskell那样,繁琐。当然显式类型声明有时是用来约束更紧的类 ...
在F#中内置了两个很有用的运算符 |> 和 >> ,用来串联数据和函数,有效减少括号的使用,让代码不那么lispy。这两个符号的定义很简单,在Ocaml中也一样可以方便使用。
运算符 |> 定义:
let (|>) x f = f x
val (|>) : 'a -> ('a -> 'b) -> 'b
例子:形如f(g(h(i(x))))可以写成x |> i |> h |> g |> f
依此类推(抱歉,例子抽象了点)
运算符 >> 定义:
let (>>) f g x = g(f(x))
val (>>) : ('a -> 'b) -> ('b -> 'c) -> ('a -> ...
Confessions of a Used Programming Language Salesman - Getting the Masses Hooked on Haskell
The author summaries that functional programming has finally reached the masses, except that it is called Visual Basic instead of Lisp, ML, or Haskell.
The study is serious, covering many cutting-edge fi ...
- 06:40
- 浏览 (1755)
- 评论 (0)
- 分类: FP
- 发布在 驾驭无形的力量—软件艺法思考 圈子
我以前总以为list comprehension这个语法糖不过就是些map,filter转换罢了,最近看到Haskell和Erlang的递归用法来实现排列,比循环方法要简洁很多:
Haskell:
java 代码
permutation [] = [[]]
permutation xs = [x:ys | x <- xs, ys <- permutation& ...
- 05:10
- 浏览 (4117)
- 评论 (5)
- 分类: FP
- 进入论坛
- 发布在 驾驭无形的力量—软件艺法思考 圈子
Why I chose erlang (very, very long story)
http://www.erlang.org/ml-archive/erlang-questions/200302/msg00013.html
I've been following the discussions about OTP the past few days and found
the comments by various participants particularly enlightening. It's
always nice to observe a lively discuss ...
1. Marshal从文件读出来的东西不包括类型信息,需要手动造型
2. 一直奇怪为什么在cygwin里的ocaml的toplevel还是不能load 'unix.cma'
原来是平台不支持动态加载,得硬把模块link进定制的toplevel:
ocamlmktop -o mytop.exe unix.cma
3. String是mutable的,best practice是作为mutable数据的buffer。
4. Array有matrix支持
5. Polymorphic Variant Types有个潜在的问题:类型推断不会约束它的内容范围。
6. Ocaml比我想的更加li ...
http://www.cs.washington.edu/education/courses/csep505/06sp/
本课程以Caml/Ocaml为蓝本介绍现代程序语言中的诸多特性,虽然这不是编译原理的课程,但是肯定也很合对此感兴趣的人的胃口。网站包括所有讲义pdf, 代码,作业和答案,授课视频和mp3。
课程大纲:
1. Purpose of studying programming languages
2. Functional programming (in Caml)
* Datatypes
* Higher-order functions
* Tail recursion
* ...
- 08:33
- 浏览 (1489)
- 评论 (0)
- 分类: FP
- 发布在 驾驭无形的力量—软件艺法思考 圈子
1. 重定义类型并不会出警告?(不对吧?)
2. int是31位,Int32才是32位。
3. bytecode模式才能debug
4. 不支持运算符重载,但能定义新运算符?(确实支持运算符重载的阿?)
5. 一个函数只能返回一种类型,注意有exception的时候。
6. 递归函数应该尽量用非递归函数封装起来以免计数参数外露
7. 尾递归判断的两个条件:1.递归调用不在try/with之中,2.返回值是确定的,不含递归调用
8. 一旦被label标识为命名参数就不能在按普通参数那样调用了(没办法,否则和curry冲突)
9. pattern match的as语法竟然没有讲,用 ...
Happen to find this nice presentation on quickly developing static DSL in OCaml. Here, 'static' means the DSL is processed by a formal compiler as opposed to dynamic DSL such as the fancy metaprogramming in Ruby in runtime. I've been learning OCaml for a while and find it amazing for the elegance, s ...
Practical Ocaml是Apress最近新书。我还在观望买不买呢?$25 for PDF...
通过采访来多了解一些巴(真佩服有人能搞访谈类的blog):
Haskell工业级编译器GHC 6.6版本刚刚发布,重要更新是可以在编译期选择让Haskell线程调度器使用多少本地线程。
Perl6实现Pugs马上采用了这一新特性,并取得明显的提速。
但是,Pugs领导者唐凤(Audrey Tang)又补充道因为受仍然是单线程的GC的限制,提速未能接近理想化的线性增加。并行GC是GHC下一版本6.8的工作目标。
发信人: faint (faint), 信区: FuncProgram
标 题: 什么是Monad(1): introduction
发信站: 水木社区 (Sun Oct 8 05:06:47 2006), 站内
在函数式编程里面,Monad是一个门槛。但是要解释“什么是monad”,这世界上没几个人
能一下讲清楚,因为涉及的背景知识太复杂。
介绍Monad可以被认为是一个"industry job":如果你能一下说清楚,就可以去当教授。
下面我说说我个人的从程序员角度的理解,目的不在于介绍monad的技术细节,而在于介
绍monad的背景和相关知识环境。
(基本概念:combin ...
The Next Mainstream Programming Language: A Game Developer's Perspective
by Tim Sweeny (from Epic Games, Unreal引擎开发公司)
http://www.st.cs.uni-sb.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf
这个presentation里作者用大量数据和实例展示了游戏开发中目前使用的编程语言(c++)在类型检验和并发处理上所遇到的困难,同时用Haskell中的一些特性探索可能的解决之道。
附:
4核CPU上的下一代 ...
- 02:51
- 浏览 (3707)
- 评论 (4)
- 分类: FP
- 进入论坛
- 发布在 驾驭无形的力量—软件艺法思考 圈子
International Conference on Functional Programming 2006大赛结果:
第三名Team: Can't Spell Awesome Without ASM, from Google,使用汇编
第二名Team kuma, from Japan,使用D语言
第一名Team Smartass, from Google,使用Haskell,并辅以C++/Python/2D语言。
Haskell连续三年蝉联第一!
ICFP2006站点:http://icfpcontest.org/index.shtml
今年的题目背景是虚拟的‘计算考古学’,要求实现 ...
Darcs 是新一代轻量级分布式版本控制系统. 完全使用Haskell编写而成。
不同于以往的版本控制系统, Darcs没有中央服务器. 任何一个本地repository都可以既是
客户端也是服务器, 节点之间可以任意同步. 这样我们可以不依赖网络离线comit任何修改:
比如在笔记本上修改, 然后回去在同步到台式机上(svn的扩展svk也能提供本地镜像以便
离线操作,但是终究还是不能脱离svn服务器). 同时Darcs的每个本地repository也可以看
作是个完整的branch, 比如我们要建立stable和dev两个版本专注于新功能和改错的不同
目的, 可以很方便地对同一个项目在本 ...
Erlang的传统优势领域是分布系统。Erlang在web应用领域发展的话我认为有以下一些局限:
-类型缺乏,连字符串类型都没有,用list模拟出来的效率低下。虽然可以通过binary方式包装,但是把简单操作搞复杂了。
-对关系数据库严重缺乏支持
-现在share-nothing的cluster对多核芯片的利用率不见得比Erlang差很多
-大部分读多写少的web应用并发瓶颈在数据库那边,Erlang的并发性对此帮助有限
当然Erlang那些在web应用上可能的困难和问题我相信都是暂时。非传统读多写少的网站也正在兴起,比如meebo, 甚至google也算。在新的需求(如实时性,数据挖掘) ...
Several friends have asked me about Haskell functional programming language. I haven't used it in daily jobs, yet I'm learning it not only because of its beauty and simplicity to express math, logic and algorthim, but also the fact that it's quite a hard excersize for my brain. There's no other lang ...
(Quoted from LexiFi)LexiFi found that a functional programming language was the most effective tool for developing compositional contract and scenario algebras.
LexiFi users derive important benefits from a functional programming approach, including:
Lists. Functional programming languages o ...
- 浏览: 319020 次
- 性别:

- 来自: Montreal

- 详细资料
搜索本博客
我的相册
20059805856241
共 10 张
共 10 张
最新评论
-
Darcs简介
good 3x
-- by 夜鸣猪 -
Pratical Ocaml作者采访
现在主要用F#分析数据,因为比较舒服(人懒啊)。其实也只用到很少的FP特性,Ru ...
-- by cookoo -
Pratical Ocaml作者采访
一年多了,呵呵,cookoo能说说看,学习使用OCaml的进展和体会吗?
-- by billgui -
Memory - 柿岛伸次
还不错啊。
-- by hazzy -
Memory - 柿岛伸次
我很想下这个,可就是不能下。LZ能否提供链接
-- by yeshucheng






评论排行榜