Skip to content

auto-curried, data-last functions #215

Open

Description

@graingert

Like lodash/fp but lazy, or https://github.com/ReactiveX/IxJS

Activity

  1. dtao commented on Feb 5, 2018

    @dtao
    Owner

    Could you elaborate on what you mean by "auto-curried"? Is this essentially a duplicate of #24?

  2. graingert commented on Feb 5, 2018

    @graingert
    Author

    @dtao no not sure what that's about. I'm talking:

    var result = Lazy(people)
      .pluck('lastName')
      .filter(function(name) { return name.startsWith('Smith'); })
      .take(5);

    becomes:

    var result = l.flow(
      l.pluck('lastName'),
      l.filter(function(name) { return name.startsWith('Smith'); }),
      l.take(5),
    )(people)
  3. dtao commented on Feb 5, 2018

    @dtao
    Owner

    Ah, gotcha. Yes, someone asked about something similar before... unfortunately I can't seem to find it.

    Anyway, I think something like this exists already. It is called apply():

    var result = Lazy([])
      .pluck('lastName'),
      .filter(function(name) { return name.startsWith('Smith'); }),
      .take(5)
      .apply(people);

    Granted, this interface is very odd (passing in an empty array initially—weird); and the implementation is very hacky. I'm not pleased with it at all. But it does exist.

    Probably I will consider changing how this works and introducing something more like what you've suggested in a future version.

  4. graingert commented on Feb 5, 2018

    @graingert
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions