Giter Site home page Giter Site logo

mapreduce's Introduction

MapReduce / ArrayLinq

build

LINQ for Delphi (Object Pascal)

TArrayContainer<T> contains methods that use higher-order functions to perform some tasks:

Every, Some, Filter, Map, FlatMap, Reduce, ForEach, Order, FirstOrDefault

(LINQ analogs: All, Any, Where, Select, SelectMany, Aggregate, ForEach, OrderBy, FirstOrDefault)

Usage

myPet := TArrayContainer<TCat>
  .Create([TCat.Create('Tiger', 10, 'black', True),
    TCat.Create('Kitty', 7, 'ginger', True),
    TCat.Create('Simba', 9, 'white', True),
    TCat.Create('Barsik', 6, 'gray', False),
    TCat.Create('Sam', 8, 'white', True),
    TCat.Create('Musya', 5, 'black', True)])
  .Filter(function(const x: TCat): boolean begin exit((x.Weight > 5) and (x.HasTail)); end)
  .Map<string>(function(const x: TCat): string begin exit(x.Name); end)
  .Order()
  .FirstOrDefault(function(const x: string): boolean begin exit(x.StartsWith('S')) end);

Writeln('Your pet is ' + myPet); // Sam

Compilation guide

In order to compile this code on Windows, you need to install the Embarcadero RAD Studio XE8 (or higher).

See also: RAD Studio docker images

mapreduce's People

Contributors

magicxor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mapreduce's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.