The Surprising Costs of Void# The surprising costs of void() and other not-quite-innocuous evils Patrice Roy Patrice.Roy@USherbrooke.ca; Patrice.Roy@clg.qc.ca CeFTI, Université de Sherbrooke; Collège Lionel-Groulx ## Who am I case of void() member functions  ## The case of void() member functions There's nothing inherently evil about void functions functions ## The case of void() member functions There’s nothing inherently evil about void functions void greeting() { cout << "I love my teacher" << endl; } int main() { greeting();0 码力 | 189 页 | 60.10 MB | 1 年前3
TypeScript 类型系统## TypeScript 类型系统 分享人:陈文岗 学校:中国科学院大学 2021年1月21日 ## 关于TypeScript TypeScript是微软推出的JavaScript静态类型版本,它是JavaScript的超集,可以编译为纯粹的JavaScript TypeScript How Does TypeScript Work? TypeScript file.ts JavaScript jpg) ## TypeScript 基础类型 // 数字类型 let num: number; num = 123; // 布尔类型 let flag: boolean; flag = false; // 字符串类型 let str: string; str = 'Hello World'; ## TypeScript 高级类型 // 数组类型 let arr: number]; arr 'chenwengang', age: 23 }; // 函数类型/函数签名 type Callback = () => void; let cb:Callback = () => { console.log('callback'); }; ## TypeScript 高级类型 // 交叉类型 type User1 = { name: string;0 码力 | 25 页 | 1.27 MB | 2 年前3
5 刘知杭 静态类型的Python## 静态类型的Python PYTHON 30th Lyzh(刘知杭) ## 目录 CONTENTS ➤ 有关类型的概念 使用mypy对Python源代码进行静态分析 代数数据类型 拓展知识 ## 关于类型的一些基本概念 有类型不等于有类型系统 PYTHON 30th 动态语言类型化的必要性 ## 不久前的一个案例 ☀️ ☀️ ☁️ rl = filter(lambda x: HttpResponse(json.dumps(rl), content_type='application/json') ## 类型的概念 CPython定义了PyObject这个结构体作为对象头。 CPython中的类型,是指在对象头中指向类型元信息的指针。 ## ●●● // cpython/include/object.h #define PyObject_HEAD PyObject CPython有类型,但CPython没有类型系统。这就是CsPython中诸多问题的由来。 ## 类型系统是什么? 类型系统(type system)是一种编译期(Compile-time)的类型推导检查规则。 类型系统(type system)的基本目标是防止程序在运行时发生类型错误。当且仅当语言运行时不存在任何形式的类型错误,那么它就是sound的。soundness是类型系统研究的重要目标。0 码力 | 42 页 | 6.87 MB | 2 年前3
基本数据类型## PyTorch ## 基本数据类型 主讲人:龙良曲 ## All is about Tensor |python|PyTorch| |---|---| |Int|IntTensor of size()| |float|FloatTensor of size()| |Int array|IntTensor of size \[d1, d2, ...]| |Float array|FloatTensor0 码力 | 16 页 | 1.09 MB | 2 年前3
MoonBit月兔编程语言 现代编程思想 第四课 多元组, 结构体,枚举类型# 现代编程思想 多元组,结构体与枚举类型 Hongbo Zhang 基础数据类型:多元组与结构体 ## 回顾:多元组 • 多元组:固定长度的不同类型数据的集合 ☐ 定义: $ (\leq $ 表达式 $ \gt $ , $ \leq $ 表达式 $ \gt $ , $ \geq $ ) ☐ 类型:(<表达式类型>,<表达式类型>,...) ○ 例如: ■ 身份信息:("Bob" == 2023 • 列表:任意长度的相同类型数据的集合 ○ 例如: ■ 字符的序列:Cons('H', Cons('i', Cons('!', Nil))) Cons : construct 的缩写 ## 笛卡尔积 - 一个多元组类型的元素即是每个组成类型的元素构成的有序元素组。集合的笛卡尔积,又称积类型 。例:扑克牌的所有花色: $ \{ $ postal: Int } 通过名称,我们能明确数据的信息以及对应字段的含义 ## 结构体的定义 - 结构体的定义形如 struct <结构体名称> { <字段名>: <类型> ; ... } o struct PersonalInfo { name: String; age: Int} • 定义结构体的值时,形如 { <字段名>: <值>0 码力 | 26 页 | 435.86 KB | 2 年前3
C++高性能并行编程与优化 - 课件 - 10 从稀疏数据结构到量化数据类型float &at(int x, int y) { return m_data[x][y]; } templatevoid foreach(Func && func) { for (int x = 0; x < N; x++) { for (int y = x, int y) { return m_data[std::make_tuple(x, y)]; } template void foreach(Func && func) { for (auto &[key, value]: m_data) { auto &[x } void write(int x, int y, float value) { auto it = m_data.find(std::make_tuple(x, y)); if (it != m_data.end()) { it->second = value; } } void create(int 0 码力 | 102 页 | 9.50 MB | 2 年前3
MoonBit月兔编程语言 现代编程思想 第五课 数据类型:树、二叉树、二叉搜索树、AVL树R-Tree:存储空间几何结构 · ..... ## 数据结构:二叉树 - 二叉树要么是一棵空树,要么是一个节点;它最多具有两个子树:左子树与右子树。 - 叶节点的两个子树都是空树 • 基于递归枚举类型的定义(本节课默认存储数据为整数) 1. enum IntTree { 2. Node(Int, IntTree, IntTree) // 存储的数据,左子树,右子树 3. Empty0 码力 | 29 页 | 1015.26 KB | 2 年前3
Mypy 1.10.0+dev Documentationtype Any are present within your codebase. ## --cobertura-xml-report DIR Causes mypy to generate a C键类型 XML type checking coverage report. To generate this report, you must either manually install the lxml are present within your codebase. cobertura_xml_report Type: string Causes mypy to generate a C键类型 XML type checking coverage report. To generate this report, you must either manually install the lxml0 码力 | 318 页 | 270.84 KB | 2 年前3
The Idris Tutorial
Version 1.3.3disjoint : (n : Nat) -> Z = S n -> Void disjoint n p = replace {P = disjointTy} p () where disjointTy : Nat -> Type disjointTy Z = () disjointTy (S k) = Void There is no need to worry too much about have an element of the empty type, we can prove anything. void is defined in the library, to assist with proofs by contradiction. void : Void -> a ### 9.3 Simple Theorems When type checking dependent use of 'hd' being partially defined empty1 : Void empty1 = hd [] where hd : List a -> a hd (x :: xs) = x -- not terminating empty2 : Void empty2 = empty2 Internally, Idris checks every definition0 码力 | 66 页 | 627.66 KB | 2 年前3
Mypy 1.8.0 Documentationtype Any are present within your codebase. ## --cobertura-xml-report DIR Causes mypy to generate a C键类型 XML type checking coverage report. To generate this report, you must either manually install the lxml are present within your codebase. ## cobertura_xml_report Type string Causes mypy to generate a C键类型 XML type checking coverage report. To generate this report, you must either manually install the lxml0 码力 | 234 页 | 902.89 KB | 2 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100













