上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 103 下一页
摘要: 三、 计算世界里的抽象 计算机世界里的抽象无处不在。 技术是问题的解决方案和手段的机制抽象; 每一类技术都建立了一套抽象,针对所面临的问题提出一种一致的机制,然后遵从该机制来实现这一类问题的求解; 开发框架是对不可变的过程抽象,将可变部分留给应用开发者根据具体问题域来定义和实现; 编程语言是对硬件执 阅读全文
posted @ 2018-10-30 12:16 zzfx 阅读(317) 评论(0) 推荐(0)
摘要: Different programming languages provide different types of abstraction, depending on the intended applications for the language. For example: In objec 阅读全文
posted @ 2018-10-30 12:01 zzfx 阅读(259) 评论(0) 推荐(0)
摘要: 所谓的抽象:只声明、未定义; 抽象机制决定了软件的架构; 关键词:动态、扩展、多态 抽象的载体: 类型抽象:协议、接口、虚基类、抽象类、泛型、基类、高阶类型; 函数抽象:高阶函数、依赖抽象类型的函数; 抽象的具体化: 继承、实现、构造; 抽象类型变量的声明(抽象的关联): 变量、参量、返回值; 抽象 阅读全文
posted @ 2018-10-30 11:45 zzfx 阅读(534) 评论(0) 推荐(0)
摘要: 总结: 1、类型约束只能添加到泛型参量上面 2、关联类型是泛型参量; 3、关联类型可以通过 协议.关联类型名称的形式引用; func allItemsMatch<C1: Container, C2: Container> (_ someContainer: C1, _ anotherContaine 阅读全文
posted @ 2018-10-26 19:12 zzfx 阅读(1446) 评论(0) 推荐(0)
摘要: struct Degoo:Equatable { var lex:String var pex:String static func == (left:Degoo, right:Degoo) ->Bool{ return true } } func == (left:Degoo, right:Deg 阅读全文
posted @ 2018-10-26 15:50 zzfx 阅读(253) 评论(0) 推荐(0)
摘要: Starting from Swift 4.1, all you have to is to conform to the Equatable protocol without the need of implementing the == method. See: SE-0185 - Synthe 阅读全文
posted @ 2018-10-26 15:26 zzfx 阅读(897) 评论(0) 推荐(0)
摘要: Special Kinds of Methods Methods associated with a type rather than an instance of a type must be marked with the static declaration modifier for enum 阅读全文
posted @ 2018-10-26 15:19 zzfx 阅读(264) 评论(0) 推荐(0)
摘要: Operator Methods Classes and structures can provide their own implementations of existing operators. This is known as overloading the existing operato 阅读全文
posted @ 2018-10-26 12:56 zzfx 阅读(218) 评论(0) 推荐(0)
摘要: 运算符:计算只依赖寄存器和cpu;运算符本身是指令集的一部分。对标表达式。 函数:以来栈帧和指令集。 运算符只能重载,不能自定义 阅读全文
posted @ 2018-10-26 11:33 zzfx 阅读(1051) 评论(0) 推荐(0)
摘要: 叔本华《充足理由律的四重根》的基本主张是,平常的世界是由四类对象构成的,它们都是表象。第一类由“现实对象”组成,如桌椅木石之类;第二类是些概念以及由这些概念组合而成的判断;第三类是时间和空间;第四类是人类行为。这四类对象的存在都必定有根据或理由,因此可以说每一个类都受制于充足理由律的一种特别的形式。 阅读全文
posted @ 2018-10-24 18:26 zzfx 阅读(4454) 评论(0) 推荐(0)
摘要: 首先,我们来看一下 Functor typeclass 的定义: 1 2 class Functor f where fmap :: (a -> b) -> f a -> f b Functor typeclass fmap (a -> b) f a f b f Functor 注:fmap 函数可 阅读全文
posted @ 2018-10-22 11:34 zzfx 阅读(185) 评论(0) 推荐(0)
摘要: 删除一个文件导致整个工程四处冒烟的工程是糟糕的工程 阅读全文
posted @ 2018-10-19 15:25 zzfx 阅读(275) 评论(0) 推荐(0)
摘要: 以最原始的方式出现在赋值操作的右侧。 阅读全文
posted @ 2018-10-15 11:03 zzfx 阅读(346) 评论(0) 推荐(0)
摘要: 面相对象关心组件的封装、结合与协作; 函数式编程关心结构的映射(输入输出)与数值处理流程。 函数式编程更接近过程式编程。 阅读全文
posted @ 2018-10-14 11:36 zzfx 阅读(345) 评论(0) 推荐(0)
摘要: 容器类型:高阶类型; 例子:集合类容器、枚举类容器、结果类容器、适配类容器。 功能: 1、值类型的封装和解封; 2、值类型的管理:存储、遍历、查询;为高阶函数; 3、惰性求值的管理:处理函数的保存、处理函数的执行(apply)。 值类型: 代表数据:用于进行处理,对应transform。 值类型的产 阅读全文
posted @ 2018-10-14 11:05 zzfx 阅读(258) 评论(0) 推荐(0)
摘要: 函数式编程的演进 数据结构与算法的结合方式:https://www.cnblogs.com/feng9exe/p/9785664.html 古典编程:数据结构+算法(C语言)。 算法的上下文通过参量和全局变量确定; 演进方向:面向对象、函数式编程; 面向对象:运算的上下文通过对象和参量确定; 对象的 阅读全文
posted @ 2018-10-12 17:31 zzfx 阅读(186) 评论(0) 推荐(0)
摘要: 高阶函数与接口混入和java匿名类。 高阶函数中的组件(参量)函数相当于面向对象中的混入(接口)类。 public abstract class Bird { private String name; public String getName() { return name; } public v 阅读全文
posted @ 2018-10-11 10:50 zzfx 阅读(343) 评论(0) 推荐(0)
摘要: 纯虚类 接口混入类 寄生类 typedef: transformX: (Value) -> U func transformFun(:value:Value) -> U 基类: public func map<T>(_ transform: (Element) throws -> T) rethro 阅读全文
posted @ 2018-10-10 19:05 zzfx 阅读(223) 评论(0) 推荐(0)
摘要: 高阶函数的本质是二阶构造、分离、配置和复用 相对于高阶函数,面向对象类似的功能是通过继承和多态实现的; func composeFun(){ //virtualFun fun() this.fun() } 高阶函数本身相当于基类; 配置函数+高阶函数相当于子类。 配置函数在高阶函数声明中的存在相当于 阅读全文
posted @ 2018-10-10 15:36 zzfx 阅读(306) 评论(0) 推荐(0)
摘要: 高阶函数是以参量和返回值的形式引用其它函数的函数; 高阶函数是开放的和变化的。 相对于基本函数来说,高阶函数提供了可配置性、变化性、开放性。 声明: 高阶函数本身的声明,引用函数的声明; 为高阶函数和引用(参量、组件)函数提供上下文; 定义: 高阶函数本身的定义; 引用(组件)函数的调用; 调用: 阅读全文
posted @ 2018-10-10 14:54 zzfx 阅读(343) 评论(0) 推荐(0)
上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 103 下一页