Last active
April 5, 2022 16:26
-
-
Save ELLIOTTCABLE/d52790220e22dcd83b6ec147d5d0bf79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Compact *) | |
List.iter (add_event (fun x -> x.read <- true)) in_fds | |
(* Less-compact *) | |
let set_as_read x = x.read <- true in | |
List.iter (add_event set_as_read) in_fds | |
(* Least-compact *) | |
let set_as_read x = x.read <- true in | |
let add_setread_event_for_single_item item = add_event set_as_read item in | |
List.iter add_setread_event_for_single_item in_fds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { add_event } from ... | |
// Least-compact, but in JavaScript | |
const set_as_read = function(x){ x.read = true } | |
const add_setread_event_for_single_item = function(item){ add_event(set_as_read, item) } | |
in_fds.forEach(add_setread_event_for_single_item) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment