Skip to content

Instantly share code, notes, and snippets.

@CliffordAnderson
Created March 23, 2015 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CliffordAnderson/076b5e82f1d7e22e05ca to your computer and use it in GitHub Desktop.
Save CliffordAnderson/076b5e82f1d7e22e05ca to your computer and use it in GitHub Desktop.
Basic Pig Latin
xquery version "3.0";
(: Takes a word in English and converts it to its equivalent in Pig Latin :)
let $word := "air"
let $vowels := ("a","e","i","o","u","y")
let $first-letter := fn:lower-case(fn:substring($word,1,1))
return
if ($first-letter = $vowels) then $word || "ay"
else fn:substring($word,2) || $first-letter || "ay"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment