Python 函数式编程工具箱 Toolz

码农软件 · 软件分类 · 常用工具包 · 2019-08-15 17:57:44

软件介绍

Toolz 是 Python 的函数式编程工具箱。Toolz 支持 Python 2.6+ 和 Python 3.3+。

Toolz 的实现包括三部分:

  • itertoolz,for operations on iterables. 例如:groupby,unique, interpose,

  • functoolz, for higher-order functions. 例如:memoize,curry, compose

  • dicttoolz, for operations on dictionaries. 例如:assoc,update-in, merge.

示例:

>>> def stem(word):
...     """ Stem word to primitive form """
...     return word.lower().rstrip(",.!:;'-\"").lstrip("'\"")
>>> from toolz import compose, frequencies, partial
>>> wordcount = compose(frequencies, partial(map, stem), str.split)
>>> sentence = "This cat jumped over this other cat!"
>>> wordcount(sentence)
{'this': 2, 'cat': 2, 'jumped': 1, 'over': 1, 'other': 1}

本文地址:https://codercto.com/soft/d/12436.html

算法设计与分析

算法设计与分析

郑宗汉/郑晓明编 / 清华大学出版社 / 2005-6 / 32.00元

《算法设计与分析》系统地介绍算法设计与分析的概念和方法,共四部分内容,第一部分包括前两章,介绍算法设计与分析的基本概念及必要的数学工具,对算法的时间复杂性的概念及算法的分析方法作了较为详细的叙述。第二部分包括第3~~9章,以算法设计技术为纲,从排序问题和离散集合的操作开始,进而介绍递归技术、分治法、贪婪法、动态规划、回溯法、分支与限界法以及随机算法等算法设计技术及其复杂性。第三部分包括第10章和第......一起来看看 《算法设计与分析》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具