Git Product home page Git Product logo

Comments (8)

lstrojny avatar lstrojny commented on September 24, 2024 1

I like it. But congratulations, you are traveling uncharted territory: operator functions. I can think of more: eq(), neq(), etc. So that one can write filter($list, and(neq('foo'), neq('bar'))) and so on. Interested on working on the whole topic?

from functional-php.

docteurklein avatar docteurklein commented on September 24, 2024 1

right! thanks

from functional-php.

docteurklein avatar docteurklein commented on September 24, 2024

Interesting topic indeed :)

I can try to implement a few of them, but this could be an iterative work, right?
Do you have an idea of a separate namespace for that?

Small note, do we need to alias and and or functions because they are reserved keywords ?

from functional-php.

docteurklein avatar docteurklein commented on September 24, 2024

@lstrojny another question regarding an implementation detail of neq.
Let's say we have implemented not and eq.

Should we implement neq by simply composing neq = not('eq') ?
Or should we use directly the != operator?

from functional-php.

lstrojny avatar lstrojny commented on September 24, 2024

@docteurklein I always try to implement the most basic version of a function, rather not reusing existing functionality but full reimplementing them. Leads to uglier code but that’s OK for primitives.

from functional-php.

docteurklein avatar docteurklein commented on September 24, 2024

agreed. I ended up using the native operator (much easier)

from functional-php.

MarcoWorms avatar MarcoWorms commented on September 24, 2024

The native operator is handy but it's not a function. When refactoring some code into a function pipeline with compose it's much better to have a not function. Also, you can achieve a declarative code style that doesn't need native operators when you have functions for everything :D

from functional-php.

leocavalcante avatar leocavalcante commented on September 24, 2024

This could be closed, I guess.
https://github.com/lstrojny/functional-php/blob/master/src/Functional/Not.php

from functional-php.

Related Issues (20)

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.