The Idris Tutorial Version 0.11
be manipulated like any other value. The standard example is the type of lists of a given length 1, Vect n a, where a is the element type and n is the length of the list and can be an arbitrary term. When therefore give the following type to the app function, which concatenates vectors: app : Vect n a -> Vect m a -> Vect (n + m) a This tutorial introduces Idris, a general purpose functional programming language the Idris library, by importing Data.Vect, or we can declare them as follows: data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Note that we have used the same0 码力 | 71 页 | 314.20 KB | 1 年前3The Idris Tutorial Version 0.9.20.1
be manipulated like any other value. The standard example is the type of lists of a given length 1, Vect n a, where a is the element type and n is the length of the list and can be an arbitrary term. When therefore give the following type to the app function, which concatenates vectors: app : Vect n a -> Vect m a -> Vect (n + m) a This tutorial introduces Idris, a general purpose functional programming language the Idris library, by importing Data.Vect, or we can declare them as follows: data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Note that we have used the same0 码力 | 71 页 | 316.18 KB | 1 年前3The Idris Tutorial Version 0.9.18
be manipulated like any other value. The standard example is the type of lists of a given length 1, Vect n a, where a is the element type and n is the length of the list and can be an arbitrary term. When therefore give the following type to the app function, which concatenates vectors: app : Vect n a -> Vect m a -> Vect (n + m) a This tutorial introduces Idris, a general purpose functional programming language the Idris library, by importing Data.Vect, or we can declare them as follows: data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Note that we have used the same0 码力 | 69 页 | 316.20 KB | 1 年前3Idris 语言文档 Version 1.3.1
标准范例就是带长度的列表类型1 Vect n a, 其中 a 为元素的类型,而 n 为该列表的长度且可以任意 长。 当类型包含了描述其性质的值(如列表的长度)时,它就能描述函数自身的性质了。 比如连接两个列 表的操作,它拥有性质:结果列表的长度为两个输入列表的长度之和。 因此我们可以为 app 函数赋予 如下类型,它用于连接向量(奖奥 奣 奴 奯奲 ): app : Vect n a -> Vect m a -> -> Vect (n + m) a 1 也许会令人困惑,它在依赖类型编程的文献中通常被称作「向量 ( V e c t o r ) 」。 夲 I d r i s 语 语 语言 言 言文 文 文档 档 档, 版 版 版本 本 本 1. 3. 1 本教程介绍了 奉 奤 奲 奩 女 ,一个通用的依赖类型函数式编程语言。奉 奤 奲 奩 女 项目旨在为可验证的通用编程打造一 个依赖类型的语言。 为此,奉 奤 它通常被称作向量 (奖奥 奣 奴 奯奲 )。向量作为 奉 奤 奲 奩 女 库的一部分,可通过导入 Data.Vect 来使用,当然我们也自己声明 它: data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a 注意我们使用了与 List 相同的构造器名。只要名字声明在不同的命名空间内0 码力 | 224 页 | 2.06 MB | 1 年前3The Idris Tutorial Version 1.3.3
u e . T h e s t an d ar d e x am p l e i s t h e t y p e of l i s t s of a gi v e n l e n gt h 1 , Vect n a, w h e r e a i s t h e e l e m e n t t y p e an d n i s t h e l e n gt h of t h e l i s t an d e t o t h e app f u n c t i on , w h i c h c on c at e n at e s v e c t or s : app : Vect n a -> Vect m a -> Vect (n + m) a T h i s t u t or i al i n t r od u c e s I d r i s , a ge n e r al p u r p y , b y i m p or t i n g Data.Vect, or w e c an d e c l ar e t h e m as f ol l ow s : data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Not e t h at w e h av0 码力 | 66 页 | 627.66 KB | 1 年前3The Idris Tutorial Version 1.3.4
u e . T h e s t an d ar d e x am p l e i s t h e t y p e of l i s t s of a gi v e n l e n gt h 1 , Vect n a, w h e r e a i s t h e e l e m e n t t y p e an d n i s t h e l e n gt h of t h e l i s t an d e t o t h e app f u n c t i on , w h i c h c on c at e n at e s v e c t or s : app : Vect n a -> Vect m a -> Vect (n + m) a T h i s t u t or i al i n t r od u c e s I d r i s , a ge n e r al p u r p y , b y i m p or t i n g Data.Vect, or w e c an d e c l ar e t h e m as f ol l ow s : data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Not e t h at w e h av0 码力 | 66 页 | 627.66 KB | 1 年前3The Idris Tutorial Version 0.99
u e . T h e s t an d ar d e x am p l e i s t h e t y p e of l i s t s of a gi v e n l e n gt h 1 , Vect n a, w h e r e a i s t h e e l e m e n t t y p e an d n i s t h e l e n gt h of t h e l i s t an d e t o t h e app f u n c t i on , w h i c h c on c at e n at e s v e c t or s : app : Vect n a -> Vect m a -> Vect (n + m) a T h i s t u t or i al i n t r od u c e s I d r i s , a ge n e r al p u r p y , b y i m p or t i n g Data.Vect, or w e c an d e c l ar e t h e m as f ol l ow s : data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Not e t h at w e h av0 码力 | 182 页 | 1.04 MB | 1 年前3The Idris Tutorial Version 1.0.1
u e . T h e s t an d ar d e x am p l e i s t h e t y p e of l i s t s of a gi v e n l e n gt h 1 , Vect n a, w h e r e a i s t h e e l e m e n t t y p e an d n i s t h e l e n gt h of t h e l i s t an d e t o t h e app f u n c t i on , w h i c h c on c at e n at e s v e c t or s : app : Vect n a -> Vect m a -> Vect (n + m) a T h i s t u t or i al i n t r od u c e s I d r i s , a ge n e r al p u r p y , b y i m p or t i n g Data.Vect, or w e c an d e c l ar e t h e m as f ol l ow s : data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Not e t h at w e h av0 码力 | 223 页 | 1.21 MB | 1 年前3The Idris Tutorial Version 1.1.0
u e . T h e s t an d ar d e x am p l e i s t h e t y p e of l i s t s of a gi v e n l e n gt h 1 , Vect n a, w h e r e a i s t h e e l e m e n t t y p e an d n i s t h e l e n gt h of t h e l i s t an d e t o t h e app f u n c t i on , w h i c h c on c at e n at e s v e c t or s : app : Vect n a -> Vect m a -> Vect (n + m) a T h i s t u t or i al i n t r od u c e s I d r i s , a ge n e r al p u r p y , b y i m p or t i n g Data.Vect, or w e c an d e c l ar e t h e m as f ol l ow s : data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Not e t h at w e h av0 码力 | 223 页 | 1.21 MB | 1 年前3The Idris Tutorial Version 1.1.1
u e . T h e s t an d ar d e x am p l e i s t h e t y p e of l i s t s of a gi v e n l e n gt h 1 , Vect n a, w h e r e a i s t h e e l e m e n t t y p e an d n i s t h e l e n gt h of t h e l i s t an d e t o t h e app f u n c t i on , w h i c h c on c at e n at e s v e c t or s : app : Vect n a -> Vect m a -> Vect (n + m) a T h i s t u t or i al i n t r od u c e s I d r i s , a ge n e r al p u r p y , b y i m p or t i n g Data.Vect, or w e c an d e c l ar e t h e m as f ol l ow s : data Vect : Nat -> Type -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a Not e t h at w e h av0 码力 | 223 页 | 1.21 MB | 1 年前3
共 108 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11