@psikosen/

OffshoreGoodSupport

Elixir

No description

fork
loading
Files
  • main.exs
  • File.txt
main.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
g = (fn a, b -> a + b end).(3, 4)

h = fn a, b -> a - b end 

c = g


y = List.flatten([1, [], 2], [3, [], 4])
[1, 2, 3, [], 4]
jk = fn a, b -> List.flatten(a,b) end

IO.inspect (jk.([1,2],[3,3]))
IO.inspect (y)

IO.puts(h.(10,4))
IO.puts(c)
IO.puts(List.last([2]))

yu = {:ok, "hello"}

IO.inspect(yu)
IO.puts(elem(yu,0))
IO.inspect([0] ++ [1,2,3])

iop = {:a,:b,:c,:d}
put_elem(iop, 2, :e)

IO.inspect(iop)


IO.inspect(File.read("File.txt"))
{a,b,c} = {:hello,"you",1}
[t | h] = [1,2,3,[]]

IO.puts(a)
IO.inspect(h)

x = 1
^x = 1
IO.puts(x)

pid = spawn fn -> 1 + 2 end
pid0 = spawn fn -> 1 + 2 end
pid1 = spawn fn a, b -> a + b end


IO.inspect(pid)
IO.inspect(pid0)
IO.inspect(pid1)

#parent = self()
#spawn fn -> send(parent, {:hello, self() }) end
#send self(), {:hello, "world"}
#receive do 
 
#end

send(self(), {:hello, "Hi people"})

receive do
   {:hello, msg} -> IO.puts(msg)
   {:another_case, msg} -> IO.puts("This one won't match!")
end


send(self(), {:fish, "Suck My Dick"})

receive do 
  {:fish, msg} -> IO.puts(msg)
  {:done, msg} -> IO.puts("DIDN'T MATCH")
end


(fn a, b ->
  send(self(),a)

  receive do 
   {:head, msg} -> IO.puts(b)
   {:tail, msg} -> IO.puts("DIDN'T MATCH")
   after
    1_100 -> "Nothing after is"
  end
end).({:head, "Die Commie"}, "Worked")

defmodule KV do
  def start_link do
    Task.start_link(fn -> loop(%{}) end)
  end

  defp loop(map) do
    recieve do
     {:get, key, caller} ->
      send caller, Map.get(map, key)
      loop(map)
     {:put, key, value} ->
    end
  end
end
#{:ok, pid} = KV.start_link

#1...100_00  |>  Stream.map(& ( &1  *  3 ) ) 

#IO.inspect(List.insert_at([1,2],2,1))
#IO.inspect(L.([1,4,6,7],5,9))