codereport / jello

A Python script for wrapping Jellyfish (a fork of Jelly) so you can more easily play with the language.
MIT License
48 stars 4 forks source link

INVESTIGATE: How to spell the D2 combinator #33

Closed codereport closed 3 months ago

codereport commented 3 months ago

While trying to solve Leetcode 3074. Apple Redistribution into Boxes, couldn't figure out how to spell the D2 combinator.

Solutions in BQN:

1‿3‿2 (1+·+´+´⊸>⟜(+`∨)) 4‿3‿1‿5‿2
1‿3‿2 {1++´(+´𝕨)>+`∨𝕩} 4‿3‿1‿5‿2

image

codereport commented 3 months ago

D2 is spelt: l f : g : r h where d2(f, g, h) = x, y -> g(f(x), h(y)).

The solution to the stated problem is below. Note the combinator tree is all wrong. image