問題タブ [lifting]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - 関数を一緒に持ち上げて構成する方法は?
私はこの構造の人々のリストを持っています:
2 つの方法で人を除外したいと思います。友達がいる場合といない場合です。さらに、次のように、の述語を持ち上げArray.filter
たいと思います。
by
次のような関数を明示的に記述することで、この動作を実現できます。
問題:逆が必要な場合は、まったく新しい関数を明示的に記述する必要があります。peopleWithoutFriends
by
関数を 2 回書きたくありません。より小さな機能を一緒に構成したいと思います。
質問:
次のような小さな関数を作成して使用するにはどうすればよいですか。flow
Boolean
get
curry
not
withFriends
withOutFriends
people
Repl: https://repl.it/@matthewharwood/ChiefWelloffPaintprogram