a list file <- File.ls!(dir), # Generate from a list(for each `dir`) path = Path.join(dir, file), # Binds values File.regular?(path) do # Filter by a predicate File.rm!(path) end # => [:ok, :ok, :ok, :ok, :ok] ## Note: In binding sections, you can filter by pattern-matching. # Bit comprehensions pixels = <<213, 45, 132, 64, 76, 32, 76, 0, 0, 234, 32, 15>> for <<r::8, g::8, b::8 <- pixels>>, do: {r, g, b} # => [{213,45,132},{64,76,32},{76,0,0},{234,32,15}] # Collect result to the stdio stream(echo program) stream = IO.stream(:stdio, :line) for line <- stream, into: stream do "#{line}\n" end