Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Last active April 5, 2022 16:26
Show Gist options
  • Save ELLIOTTCABLE/d52790220e22dcd83b6ec147d5d0bf79 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/d52790220e22dcd83b6ec147d5d0bf79 to your computer and use it in GitHub Desktop.
(* 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
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