News for hackers. Stuff that matters.
Re:Verb-Noun vs. Noun-Verb by Garph on Wednesday October 16, 2019 @08:57PM (#21277922)
I don't enjoy balancing parentheses in Python so I tried to bring Clojure's threading macro into the language...

  def do(x, fs):
      for f in fs:
          x = f(x)
      return x
Which allows left-to-right style programming

  do(list, filter, partial(map, int), sum)
I haven't put this into production code yet, but love pipelining scripts with do
Re:Verb-Noun vs. Noun-Verb by sooheon on Thursday October 17, 2019 @12:33AM (#21278940)
Also see PyToolz's implementation: https://toolz.readthedocs.io/en/latest/api.html#toolz.functo...

They differentiate thread first/last for Fns with arity > 1, just like Clojure.

Re:Verb-Noun vs. Noun-Verb by karmakaze on Wednesday October 16, 2019 @09:09PM (#21277990)
I made a thing[0] just like that to do pipelined async db queries:

  CompletableFuture<Member> asyncProjectMembers =
    Async.pipeline(Accounts.where("id >= ?", 1000);,
                   (accounts) -> accounts.loadProjects("updated_at >= ?", Instant.now().minusDays(30)),
                   (projects) -> projects.loadMembers());
If you assign the intermediates to variables, each instance will have associated with it the related collection that's queried while avoiding N+1's.

[0] https://github.com/karmakaze/safeql