Skip to content

Instantly share code, notes, and snippets.

@jrsonline
Last active January 31, 2018 04:13
Show Gist options
  • Save jrsonline/77997a5e70ea7698dc789d8cdf8a0382 to your computer and use it in GitHub Desktop.
Save jrsonline/77997a5e70ea7698dc789d8cdf8a0382 to your computer and use it in GitHub Desktop.
Magic Objects: Lifts and Lowers
let aas = [1,2,3]^ // "lifts" a to Construct<ArrayTag,Int>
/// the below are all equivalent ways to lower, pick the one that looks best to you
let array1 = aas.toArray
let array2 = Array.lower(aas)
let array3 = aas >>>¬ toArray // "continuation-passing" style. ¬ is ALT-L. >>>¬ is "lower"
let array4 = aas.lower
let array5 = aas¬
let bbs = LinkedList(array: ["a","b","c"])^ // lifts to Construct<LinkedListTag,String>
/// the below are all equivalent ways to lower, pick the one that looks best to you
let list1 = bbs.toLinkedList
let list2 = LinkedList.lower(bbs)
let list3 = bbs >>>¬ toLinkedList
let list4 = bbs.lower
let list5 = bbs¬
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment