Leonard/Janis Robert König on Nostr: That being said, is there a more elegant way to implement something like this: ``` ...
That being said, is there a more elegant way to implement something like this:
```
ghci> decider x = if x < 0 then ([x],[]) else ([],[x])
ghci> foldMap (decider) [-3,5,0,-1,6,2,-1]
([-3,-1,-1],[5,0,6,2])
```
Published at
2023-10-24 10:16:56Event JSON
{
"id": "eee0e32a5a05c8a166732479cc5f2c1941edf39fad103bae1aff19b3420d6d25",
"pubkey": "e2758e166e0556cc0d19edd264ab6628420acccdfb52a575f6ddd7cb79a056e4",
"created_at": 1698142616,
"kind": 1,
"tags": [
[
"e",
"fd32deb9f19a7dea7b306b68e40ec53f47b7f6a8da72d38a7f8766075b7de1d4",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://todon.eu/users/ljrk/statuses/111289474500645195",
"activitypub"
]
],
"content": "That being said, is there a more elegant way to implement something like this:\n\n```\nghci\u003e decider x = if x \u003c 0 then ([x],[]) else ([],[x])\nghci\u003e foldMap (decider) [-3,5,0,-1,6,2,-1]\n([-3,-1,-1],[5,0,6,2])\n```",
"sig": "4cd0624b3dd6819a2fa7a7f5f9460973f5325cdb7c04e9a0d8f58349c1fbb7fdbe01d312099fe4f815a0bc101a739a15c9b4bff5126c8cb44460513d7267f75a"
}