Skip to content

Instantly share code, notes, and snippets.

@justin2004
Created January 20, 2026 19:08
Show Gist options
  • Select an option

  • Save justin2004/1266b8521db2133a08f3ec4bc2248546 to your computer and use it in GitHub Desktop.

Select an option

Save justin2004/1266b8521db2133a08f3ec4bc2248546 to your computer and use it in GitHub Desktop.
torus vowels
torusVowels{
v ⎕av vector of chars (that we index into)
c v c as in cipher text (using indexes instead of chars)
mcv'aeiou' mask of vowels
v[(m\¯10~m×c)+ c×~m]
^ keep the consonants
^ select the only vowels
^ then do a ¯1 rotate to shift them to the right
^ finally expand using the mask so we can recombine vowels and consonants
}
def torusVowels(s):
x=[i for i,c in enumerate(s)if c.lower()in"aeiou"]
l=list(s)
for i in range(len(x)):l[x[(i+1)%len(x)]]=s[x[i]]if x else s[x[i]]
return''.join(l)
@justin2004
Copy link
Author

¯1@{'aeiou'} 'hello there opal'  works using @

 how about just on words
¯1@{'aeiou'}¨' '()'hello there opal'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment