Skip to content

Instantly share code, notes, and snippets.

@a2ndrade
Last active August 5, 2016 15:44
Show Gist options
  • Select an option

  • Save a2ndrade/08bb7417b901e904d3b4 to your computer and use it in GitHub Desktop.

Select an option

Save a2ndrade/08bb7417b901e904d3b4 to your computer and use it in GitHub Desktop.
Atomic
/ data sample
V:"abcdefghijklmnopqrstuvwxyz" / universe of values
e:1 1 2 3 4 4 4 4 4 4 4 5 6 6 6 6 6 6 8 8 / entity column
v:V@(#e)?#V / value column
t:1+!#v / transaction column
historical:+`e`v`t!(e;v;t) / historical table
/ snapshot table as-of transaction *15*
whereAsOfTx:&~t>15
asOfE:e[whereAsOfTx]
whereLatestE:-1+*:'1_=asOfE,#asOfE
uniqueE:e[whereLatestE]
latestV:v[whereLatestE]
whereSortedV:<latestV
eSortedByV:uniqueE[whereSortedV]
sortedV:latestV[whereSortedV]
snapshot:(+(,`e)!,eSortedByV)!+(,`v)!,sortedV / snapshot table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment