0 Replies - 1065 Views - Last Post: 13 April 2011 - 12:15 AM

#1 Shane Hudson  Icon User is offline

  • D.I.C Technophile
  • member icon

Reputation: 345
  • View blog
  • Posts: 1,286
  • Joined: 06-December 09

Haskell Letter Combinations

Posted 13 April 2011 - 12:15 AM

Description: Run this code in GHCi. This is probably not particularly useful but I wrote it a while ago and its a very cool piece of code! Basically it gives out all combinations of 3 letters, then outputs it to a file.
let all = ['a'..'z']
let letters = [(a,b,c) | a <- all, b <- all, c <- all]
-- If you want to save to a text file (probably more convenient than just printing to the screen
writeFile "letterCombinations.txt"
   (show letters)



Is This A Good Question/Topic? 0
  • +

Page 1 of 1