First-class functions: Difference between revisions

Content added Content deleted
(add BQN)
Line 510: Line 510:
<code>∘</code>(Atop) is used here to compose the two lists of functions given. Higher order functions are then used to apply the functions on a value. There is a slight change in value due to floating point inaccuracy.
<code>∘</code>(Atop) is used here to compose the two lists of functions given. Higher order functions are then used to apply the functions on a value. There is a slight change in value due to floating point inaccuracy.


BQN has provisions to invert builtin functions using <code>⁼</code>(Undo), and that can also be used for this demonstration(<code>funsB ← {𝕏⁼}¨ funsA</code>).
BQN has provisions to invert builtin functions using <code>⁼</code>(Undo), and that can also be used for this demonstration, if we remove the user defined function(<code>funsB ← {𝕏⁼}¨ funsA</code>).


<lang bqn>funsA ← ⟨⋆⟜2,-,•math.Sin,{𝕩×3}⟩
<lang bqn>funsA ← ⟨⋆⟜2,-,•math.Sin,{𝕩×3}⟩