To demonstrate derivation of monadic programs, we present a specification of sorting using the non-determinism monad, and derive pure quicksort on lists and state-monadic quicksort on arrays. In the derivation one may switch between point-free and pointwise styles, and deploy techniques familiar to functional programmers such as pattern matching and induction on structures or on sizes. Derivation of stateful programs resembles reasoning backwards from the postcondition.


翻译:为了展示蒙拿迪程序衍生,我们提出了一个使用非确定性山岳来分类的规格,并且从列表和阵列上产生纯等离子体,并在阵列上产生纯等离子体。 在引出时,我们可以在点和点风格之间转换,并运用功能程序员熟悉的技术,如结构或大小上的模式匹配和感应。 典型程序的推理类似于后条件的倒推理。

0
下载
关闭预览

相关内容

专知会员服务
154+阅读 · 2021年3月6日
专知会员服务
79+阅读 · 2020年9月28日
专知会员服务
17+阅读 · 2020年9月6日
专知会员服务
59+阅读 · 2020年3月19日
RL 真经
CreateAMind
5+阅读 · 2018年12月28日
已删除
将门创投
3+阅读 · 2018年8月21日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Arxiv
4+阅读 · 2018年4月30日
VIP会员
相关VIP内容
相关资讯
RL 真经
CreateAMind
5+阅读 · 2018年12月28日
已删除
将门创投
3+阅读 · 2018年8月21日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Top
微信扫码咨询专知VIP会员