Skip to content

Instantly share code, notes, and snippets.

@cronin101
Last active August 29, 2015 13:57
Show Gist options
  • Save cronin101/9723948 to your computer and use it in GitHub Desktop.
Save cronin101/9723948 to your computer and use it in GitHub Desktop.
yum, code generation.
main ⭔ (1..100)[Int].map { |x| x + 10 }.map { |y| y * y}.filter { |x| x.even? }.filter { |y| y < 200 }[Fixnum]
#[2014-03-23 14:44:27 +0000] Simplify!: Simplified from [["x = x >> 1", "x = x + 10", "x = x * x"], ["x = x + 10"], ["x = x * x"], ["((x % 2 == 0)) && (x < 200)"], ["x < 200"], ["x = (x << 1) | 0x01"]], to [["x = x >> 1", "x = x + 10", "x = x * x", "?{((x % 2 == 0)) && (x < 200)}?", "x = (x << 1) | 0x01"]].
#[2014-03-23 14:44:27 +0000] Executing filter kernel:
# __kernel void hadopemappingfilter7(__global int *data_array, __global int *presence_array) {
# int x;
# int global_id = get_global_id(0);
# x = data_array[global_id];
#
# x = x >> 1;
# x = x + 10;
# x = x * x;
#;
#int flag = ((x % 2 == 0)) && (x < 200) ? 1 : 0;
#x = (x << 1) | 0x01;
#
# presence_array[global_id] = flag;
# data_array[global_id] = x;
#
#}
=> [144, 196]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment