承接 tmanley1985/php-transducers 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tmanley1985/php-transducers

最新稳定版本:v1.0.1

Composer 安装命令:

composer require tmanley1985/php-transducers

包简介

An implementation of transducers for php

README 文档

README

An implementation of transducers in php

About

Transducers allow you to compose map and filter operations without the need for intermediate data structures by composing reducing functions (reducers). They're like a factory for reducing functions. Whenever you run a map or filter operation, you're creating a new intermediate data structure which is usually negligible, but as the size of your input scales, so do these operations.

True transducers should be able to operate on multiple data structures: trees, streams, arrays, etc. This library only operates on arrays.

I've created two videos as part of a larger series on the reduce method on youtube. All examples are in es6:

  1. Transducers: Mapping
  2. Transducers: Filtering

TOC

Installation

First:

composer require tmanley1985/php-transducers

Usage

use TManley1985\PhpTransducers\TransducibleCollection;

TransducibleCollection::fromValues([10,11,12,13])
    ->transMap(fn ($num) => $num + 1)
    ->transFilter(fn ($num) => $num % 2 === 0)
    ->transduce(); // [12,14]

Versioning

We use SemVer for versioning.

License

This project is licensed under the MIT License

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-07