Skip to content

Instantly share code, notes, and snippets.

@mpahrens
Created November 25, 2015 03:37
Show Gist options
  • Save mpahrens/9262c76aa5388834a0d9 to your computer and use it in GitHub Desktop.
Save mpahrens/9262c76aa5388834a0d9 to your computer and use it in GitHub Desktop.
#Matthew Ahrens: Nov 24th, 2015
#sets up a lambda to take the split arguments: n is the num of the shift, m is the message
# reads the codepoints from the binary representation of the message, returns 32 (\space) if space, and shifts (looping around) otherise
#uses IO.gets |> String.split(",") as an argument to the lambda
# 132 characters
fn[n,m]->for<<x<-m>>,into: "",do: <<(if x<?a,do: 32,else: rem(x+String.to_integer(n)-?a,26)+?a)>>end.(String.split IO.gets(""),",")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment