Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 25th, 2012  |  syntax: None  |  size: 0.28 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. lists:append with list comprehensions
  2. 1> append([[1, 2, 3], [a, b], [4, 5, 6]]).
  3. [1,2,3,a,b,4,5,6]
  4.        
  5. 1> Lists = [[1, 2, 3], [a, b], [4, 5, 6]].
  6. [[1,2,3],[a,b],[4,5,6]]
  7. 2> [N || L <- Lists, N <- L].            
  8. [1,2,3,a,b,4,5,6]
  9.        
  10. [Y || X <- [[1,2,3],[a,b],[4,5,6]], Y <- X ].