`
linkerlin
  • 浏览: 33713 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Clojure 的量子特性

阅读更多

(defprotocol X (cat [this other]))

定义一个协议,这个和Objective-C的协议很像。不同于Java的接口。
user=> X
{:on-interface user.X, :on user.X, :sigs {:cat {:doc nil, :arglists ([this other]), :name cat}}, :var #'user/X, :method-map {:cat :cat}, :method-builders {#'user/cat #<user$eval12$fn__13 user$eval12$fn__13@13cc0a7f>}}

user=> (extend-type String X (cat [this other] (.concat this other)))
这个就很ObjC的风格。把一个函数作为一个类型在一个协议下的实现,定义出来。
user=> (cat "AA" "BB")
"AABB"
就思想上来说,FP和OO是反的。一个以函数为核心,一个以数据为核心。
而Lisp,则是分两个层面,就基础层,一切都属数据。但是在抽象层,一切都是函数和函数调用了。
或者可以这么说,Lisp有类似量子光学里面的波粒二相性的特性,“动”——是 函数调用,“静”——是 数据。

 

分享到:
评论

相关推荐

    Programming Clojure 英文电子版

    这是Programming Clojure 电子版的 纸质版本在美国亚马逊要到2009年3月才能上架 Paperback: 200 pages Publisher: Pragmatic Bookshelf (March 15, 2009) Language: English ISBN-10: 1934356336 ISBN-13: 978-...

    Clojure可选类型系统TypedClojure.zip

    主要特性:从 Java 中保护你的 Clojure 程序,进行安全的互操作,正确的使用外部 Java 库。Typed Clojure 支持关键字映射的使用,类型检测器中包含有用的映射操作,包括关键字查找,添加或者移除关键字,合并映射...

    Clojure编程乐趣

    Clojure is an opinionated language—it doesn’t try to cover all paradigms or provide every checklist bullet-point feature. Instead it provides the features needed to solve all kinds of real-world ...

    Professional.Clojure.1119267277

    Clear, practical Clojure for the professional programmer Professional Clojure is the experienced developer's guide to functional programming using the Clojure language. Designed specifically to meet ...

    Practical Clojure.pdf

    Practical Clojure Clojure语言书籍

    clojure eclipse

    clojure clojure clojureclojure clojure

    clojure相关书籍1

    【1】[Clojure编程乐趣](The Joy of Clojure).pdf 【2】Clojure – Functional Programming for the JVM中文版.pdf 【3】Clojure Cookbook.pdf 【4】Clojure Data Analysis Cookbook.pdf 【5】clojure Hand book...

    Clojure电子书合集2(13本)

    [2013] Functional Programming Patterns in Scala and Clojure - Write Lean Programs for the JVM.(Michael Bevilacqua-Linn).[1937785475].pdf+epub.rar [2014] Clojure Cookbook - Recipes for Functional ...

    Clojure编程乐趣]+clojure_programming.pdf

    Clojure编程乐趣和clojure_programming.pdf两本书

    Clojure电子书合集1(12本)

    [2009] Programming Clojure.(Stuart Halloway).[1934356336].pdf [2010] Functional Programming with Clojure - Simple Concurrency on the JVM.(Tim Berglund, Matthew McCullough).[193650202X].pdf [2010] ...

    Mastering.Clojure.1785

    Learn to handle data using sequences, reducers, and transducers in Clojure Explore the lesser known and more advanced features, constructs, and methodologies of the Clojure language and its ecosystem,...

    Clojure入门教程- Clojure – Functional Programming for the JVM中文版

    Clojure入门教程- Clojure – Functional Programming for the JVM中文版

    [Clojure] Clojure 编程 (英文版)

    [奥莱理] Clojure 编程 (英文版) [奥莱理] Clojure Programming (E-Book) ☆ 出版信息:☆ [作者信息] Chas Emerick, Brian Carper, Christophe Grand [出版机构] 奥莱理 [出版日期] 2012年04月19日 [图书页数...

    clojure1.3.0及资料

    clojure1.3.0及资料,附《Programming Clojure》,《Practical Clojure》

    Clojure Data Analysis Cookbook

    Clojure Data Analysis Cookbook

    有关JAVA的译文 Clojure:“挑战”Java编程语言

    Clojure是一个JVM的动态函数式语言,最近发布了1.0版本,版本中Clojure提供了一个健壮的代码。Clojure是一套发展快速的新的编程语言,特别是,它为多核计算做了新的解决方案。在今后的软件设计中无论使用Clojure语言...

    clojure相关书籍2

    【1】Web Development with Clojure(2014.1).pdf 【2】clojure_programming.pdf 【3】Practical Clojure.pdf 【4】Programming Clojure with Emacs.pdf 【5】Programming Concurrency on the JVM(Java虚拟机并发编程...

    The Joy of Clojure, 2nd Edition

    The Joy of Clojure, Second Edition is a deep look at the Clojure language. Fully updated for Clojure 1.6, this new edition goes beyond just syntax to show you the "why" of Clojure and how to write ...

    Clojure入门教程.pdf

    Clojure入门教程

Global site tag (gtag.js) - Google Analytics