`
cookoo
  • 浏览: 647376 次
  • 性别: Icon_minigender_1
  • 来自: Shanghai
社区版块
存档分类
最新评论
文章列表
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语法竟然没有讲,用了 ...
context switch不足以表明coroutine,一般的方法调用(subroutine)也是context switch的,只有能保留上次context的(continuation)才是coroutine。Ruby的yield只是种匿名函数调用的syntax sugar。布娃娃用的yield 1, yield2, yield3的例子是用1,2,3去初始化块变量, block本身不记得上次的context: >> def test2 >> yield >> yield ...
Quoted from wikipedia: Like other Google web applications, a large amount of JavaScript was used to create Google Maps. As the user drags the map, the grid squares are downloaded from the server and displayed to the user. When a user searches for a business, the location is pin-pointed with a red pi ...
Wolf's Rain/狼雨 是部味道比较淡节奏比较慢的动画作品,现在只隐约还记得那个人与狼共存的美丽异世界。也许是因为菅野洋子大师级的配乐过于出色了巴,反而掩盖了本就不曲折的情节。其中这首经由坂本真绫天使般嗓音演绎的片尾曲Gravity尤其让人动容:重力的牵扯,自由的渴望,归家的漫漫长路。。。尽在不言中。 作词:troy 作曲·編曲:菅野洋子 演唱:坂本真绫 Been a long road to follow Been there and gone tomorrow Without saying goodbye to yesterday Are the memories I hol ...
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, sp ...
I've just noticed that before_filter can absorb a block in order to pass parameters to pre-executed actions. Here's an example:     before_filter{|c| c.authorized(1)} However, in such case, action authorized must be public, while in the tradtional way,     before_filter :authorized the action c ...
Today, when I review Steve Jobs' Stanford commencement speech, I suddenly notice one phrase that I omitted though I've listened/seen that audio/video many times: "ten years later". I'm deeply moved. How long would a person take to begin as a garbage collector to the founder of the most c ...

5 myths of ETF

ETFs are hot these years with increasing public attention over other kinds of fund. However, Exchange-Traded Fund Myths Busted (from morningstar.com) discovers some of the "famous" myths behind the shine of ETF. ETFs are getting all the fund flows. ETFs must perform better than mutual fund ...

Ruby小窍门3则

    博客分类:
  • Ruby
*怎么转16进制? class Integer def to_hex sprintf "%x", self end end 16.to_hex #=> 10 *怎么scan出utf-8字符串中的中文字符? requrie 'jcode' $KCODE = 'u' class String def scan_chinese self.scan /[\340\270\200-\351\276\237]/ end end *怎么在case when里匹配一个array? colors = %w{re ...
opera只有notebook记些文本. scrapbook我早就放弃了,还是直接用del.icio.us加个bookmark比较方便,没有同步问题,搜索也简单。我现在对用层次目录结构而不是tag方式组织的大量内容的使用和维护效率非常怀疑。 我自己的浏览器bookmark有些目录过于膨胀我都懒得去看了。多讽刺啊,记了那么多东西结果倒头来反而找个东西越来越慢只好不用了。以前我还定期费时间整理目录,自从我意识到这是层次目录结构的‘原罪’后我就放弃整理了。 层次目录的问题关键在于后期维护代价太高。对比层次和tag,当一个目录下东西太多的时候,搜索时间明显增加,解决办法是建子目录进一步分类。而一个t ...

iBelieve

Now even God loves ipod. Great religious idea.
美加这两个国家貌合神离,同床异梦,连有些宗教节日也不是同一天。主要有两个原因:     1. 加拿大是当初美国搞独立时仍然忠于英国的保皇派逃到北面自立为王出来的 2. 现在加拿大社会中坚很多是美国越战时期的反战分子为了逃避兵役移民过来的,这些人多半是有文化的知识阶层,不满美国政策。(据说每次美国要打仗了,加拿大移民人数就暴涨。。。) 所以: 1. 加拿大人最讨厌被人当成美国人 2. 美国人当加拿大人是乡巴佬,加拿大人当美国人是没事带把枪的流氓    总结: 难兄难弟哈哈
Youtube版: http://www.youtube.com/watch?v=Bgg7LEaB5b4 Apple官方高清晰版:(需quicktime) http://www.apple.com/education/whymac/compsci/video.html Jason Fried和DHH真是有明星像 (robbin, 啥时候这里能直接插flash?)
Practical Ocaml是Apress最近新书。我还在观望买不买呢?$25 for PDF... 通过采访来多了解一些巴(真佩服有人能搞访谈类的blog):
如果你要定制Rails的违例输出页面的话的,一般会用这样的代码: class ApplicationController < ActionController::Base ... def rescue_action_in_public(exception) case exception when ::ActionController::UnknownAction render_with_layout .... when ActiveRecord::RecordNotFound ... end ...
Global site tag (gtag.js) - Google Analytics