: Feb15 ; iex Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> import Enum Enum iex(2)> map([1,2,3],fn x -> x+1 end) [2, 3, 4] iex(3)> c Loop ** (ArgumentError) expected a binary or a list of binaries as argument (iex) lib/iex/helpers.ex:155: IEx.Helpers.c/2 iex(3)> c "Loop" ** (ArgumentError) could not find files Loop (iex) lib/iex/helpers.ex:161: IEx.Helpers.c/2 iex(3)> c "Loop.ex" [Loop] iex(4)> doit [1,4,7] ** (CompileError) iex:4: undefined function doit/1 iex(4)> Loop.doit [1,4,7] [2, 5, 8] iex(5)> c "Loop.ex" warning: redefining module Loop (current version defined in memory) Loop.ex:1 [Loop] iex(6)> Loop.doit1 [1,4,7] [2, 4, 7] iex(7)> recompile Mix is not running. Please start IEx with: iex -S mix :error iex(8)> c "Loop.ex" warning: redefining module Loop (current version defined in memory) Loop.ex:1 [Loop] iex(9)> Loop.doit1 [1,4,7] [2, 5, 8] iex(10)> [3..6] [3..6] iex(11)> c "Loop.ex" warning: redefining module Loop (current version defined in memory) Loop.ex:1 [Loop] iex(12)> Loop.doit2 [3..10] ** (ArithmeticError) bad argument in arithmetic expression Loop.ex:15: Loop.doit2/1 iex(12)> Loop.doit2 [3,4,10] [4, 5, 11] iex(13)> c "Loop.ex" warning: redefining module Loop (current version defined in memory) Loop.ex:1 [Loop] iex(14)> Loop.range(3,10) [3, 4, 5, 6, 7, 8, 9, 10] iex(15)> Loop.range(3,2) ^C ^C ^C ^C: Feb15 ; : Feb15 ; iex Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> c "loop.ex" [Loop] iex(2)> Loop.range(3,10) [3, 4, 5, 6, 7, 8, 9, 10] iex(3)> Loop.range(3,2) [3] iex(4)> c "loop.ex" warning: redefining module Loop (current version defined in memory) loop.ex:1 [Loop] iex(5)> Loop.range(3,2) [] iex(6)> Loop.range(3,3) [3] iex(7)> for x <- [3,4,5], do: x+1 [4, 5, 6] iex(8)> for x <- [3,4,5], y <- [2,3], do: x+y [5, 6, 6, 7, 7, 8] iex(9)> for x <- [3,4,5], y <- [2,3], z <- [5,10], do: (x+z)*y [16, 26, 24, 39, 18, 28, 27, 42, 20, 30, 30, 45] iex(10)> for x <- [3,4,5], y <- [2,3], z <- [5,10], do: (x+z)*y+64 'PZXgR\\[jT^^m' iex(11)> [65,66,67] 'ABC' iex(12)> [5,6,7] [5, 6, 7] iex(13)> [65,66,67,1] [65, 66, 67, 1] iex(14)> 'ABC'=="ABC" false iex(15)> for x <- [3,4,5], y <- [2,3], do: {x,y} [{3, 2}, {3, 3}, {4, 2}, {4, 3}, {5, 2}, {5, 3}] iex(16)> deck = for rank <- '234567891JQKA',suit <- 'CDHS', do: [rank,suit] ['2C', '2D', '2H', '2S', '3C', '3D', '3H', '3S', '4C', '4D', '4H', '4S', '5C', '5D', '5H', '5S', '6C', '6D', '6H', '6S', '7C', '7D', '7H', '7S', '8C', '8D', '8H', '8S', '9C', '9D', '9H', '9S', '1C', '1D', '1H', '1S', 'JC', 'JD', 'JH', 'JS', 'QC', 'QD', 'QH', 'QS', 'KC', 'KD', 'KH', 'KS', 'AC', 'AD', ...] iex(17)> deck |> shuffle |> take(13) ** (CompileError) iex:17: undefined function take/2 (elixir) expanding macro: Kernel.|>/2 iex:17: (file) iex(17)> ^C ^C BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution ^C ^C: Feb15 ; : Feb15 ; echo $TERM dumb : Feb15 ; export TERM=emacs : Feb15 ; iex Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> 3 3 iex(2)> ^C ^C BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution ^C ^C: Feb15 ; iex Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> IO.ANSI.reset() "\e[0m" iex(2)> configuration ** (CompileError) iex:2: undefined function configuration/0 iex(2)> IEx.configuration [default_prompt: "%prefix(%counter)>", alive_prompt: "%prefix(%node)%counter>", colors: [], history_size: 20, inspect: [pretty: true]] iex(3)> IEx.configure [colors: [eval_result: false]] ** (ArgumentError) invalid ANSI sequence specification: false (elixir) lib/io/ansi.ex:179: IO.ANSI.format_sequence/1 (elixir) lib/io/ansi.ex:230: IO.ANSI.do_format/5 (elixir) lib/inspect/algebra.ex:651: Inspect.Algebra.format/3 (elixir) lib/inspect/algebra.ex:652: Inspect.Algebra.format/3 (elixir) lib/inspect/algebra.ex:651: Inspect.Algebra.format/3 (elixir) lib/kernel.ex:1698: Kernel.inspect/2 iex(3)> 3 ** (ArgumentError) invalid ANSI sequence specification: false (elixir) lib/io/ansi.ex:179: IO.ANSI.format_sequence/1 (elixir) lib/io/ansi.ex:230: IO.ANSI.do_format/5 (iex) lib/iex.ex:427: IEx.color/2 iex(3)> IEx.configure [colors: [eval_result: :black]] :ok iex(4)> IEx.configure [colors: [eval_result: :white]] :ok iex(5)> IEx.configure [colors: [anabled: false]] :ok iex(6)> 34 34 iex(7)> IEx.Options.set :colors, anabled: false ** (UndefinedFunctionError) function IEx.Options.set/2 is undefined (module IEx.Options is not available) IEx.Options.set(:colors, [anabled: false]) iex(7)> ^C ^C BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution ^C ^C: Feb15 ; env|grep TERM TERM=emacs TERMCAP= : Feb15 ; unset TERMCAP : Feb15 ; unset TERM : Feb15 ; env|grep TERM : Feb15 ; iex Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> 3 3 iex(2)> IEx.configure [colors: [eval_result: :blue]] :ok iex(3)> 3 3 iex(4)> IEx.configure [colors: [eval_result: :darkblue]] ** (ArgumentError) invalid ANSI sequence specification: :darkblue (elixir) lib/io/ansi.ex:179: IO.ANSI.format_sequence/1 (elixir) lib/io/ansi.ex:230: IO.ANSI.do_format/5 (elixir) lib/inspect/algebra.ex:651: Inspect.Algebra.format/3 (elixir) lib/inspect/algebra.ex:652: Inspect.Algebra.format/3 (elixir) lib/inspect/algebra.ex:651: Inspect.Algebra.format/3 (elixir) lib/kernel.ex:1698: Kernel.inspect/2 iex(4)> IEx.configure [colors: [eval_result: :blue]] :ok iex(5)> IEx.configure [colors: [eval_result: :black]] :ok iex(6)> 3 3 iex(7)> c "loop.ex" [Loop] iex(8)> import Loop Loop iex(9)> doit1 [3,4,5] [4, 5, 6] iex(10)> import Loop Loop iex(11)> c "loop.ex" warning: redefining module Loop (current version defined in memory) loop.ex:1 [Loop] iex(12)> c "loop.ex" warning: redefining module Loop (current version defined in memory) loop.ex:1 = Compilation error in file loop.ex == ** (CompileError) loop.ex:22: undefined function range/2 (stdlib) lists.erl:1338: :lists.foreach/2 (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6 ** (CompileError) compile error (iex) lib/iex/helpers.ex:178: IEx.Helpers.c/2 iex(12)> c "loop.ex" warning: redefining module Loop (current version defined in memory) loop.ex:1 [Loop] iex(13)> num(3) ** (CompileError) iex:13: undefined function num/1 iex(13)> import Loop Loop iex(14)> num(3) "three" iex(15)> import List List iex(16)> deck = for rank <- '234567891JQKA',suit <- 'CDHS', do: [rank,suit] ['2C', '2D', '2H', '2S', '3C', '3D', '3H', '3S', '4C', '4D', '4H', '4S', '5C', '5D', '5H', '5S', '6C', '6D', '6H', '6S', '7C', '7D', '7H', '7S', '8C', '8D', '8H', '8S', '9C', '9D', '9H', '9S', '1C', '1D', '1H', '1S', 'JC', 'JD', 'JH', 'JS', 'QC', 'QD', 'QH', 'QS', 'KC', 'KD', 'KH', 'KS', 'AC', 'AD', ...] iex(17)> deck |> shuffle |> take(13) ** (CompileError) iex:17: undefined function take/2 (elixir) expanding macro: Kernel.|>/2 iex:17: (file) iex(17)> for x <- [3..6], y <- [3,4], x>y, do: x [3..6, 3..6] iex(18)> for x <- [3,4,5,6], y <- [3,4], x>y, do: x [4, 5, 5, 6, 6] iex(19)> for x <- [3,4,5,6], x<6, y <- [3,4], x>y, do: x [4, 5, 5] iex(20)> for x <- [3,4,0,6], y <- 12 / x, x>y, do: x ** (Protocol.UndefinedError) protocol Enumerable not implemented for 4.0 (elixir) lib/enum.ex:1: Enumerable.impl_for!/1 (elixir) lib/enum.ex:116: Enumerable.reduce/3 (elixir) lib/enum.ex:1847: Enum.reduce/3 (elixir) lib/enum.ex:1826: Enum."-reduce/3-lists^foldl/2-0-"/3 iex(20)> for x <- [3,4,0,6], x!=0, y <- 12 / x, x>y, do: x ** (Protocol.UndefinedError) protocol Enumerable not implemented for 4.0 (elixir) lib/enum.ex:1: Enumerable.impl_for!/1 (elixir) lib/enum.ex:116: Enumerable.reduce/3 (elixir) lib/enum.ex:1847: Enum.reduce/3 (elixir) lib/enum.ex:1826: Enum."-reduce/3-lists^foldl/2-0-"/3 iex(20)> for x <- [3,4,0,6], x!=0, y <- 12 // x, x>y, do: x ** (SyntaxError) iex:20: syntax error before: '/' iex(20)> c "fib.ex" [Fib] iex(21)> Fib.fib 1 1 iex(22)> Fib.fib 2 2 iex(23)> Fib.fib 3 3 iex(24)> Fib.fib 4 5 iex(25)> Fib.fib 5 8 iex(26)> Fib.fib 35 14930352 iex(27)> Fib.fib 40 165580141 iex(28)> c "fib.ex" warning: redefining module Fib (current version defined in memory) fib.ex:1 [Fib] iex(29)> Fib.fact(5) 120 iex(30)> Fib.fact 100 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 iex(31)> Fib.fact 1000 402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 iex(32)> c "fib.ex" warning: redefining module Fib (current version defined in memory) fib.ex:1 [Fib] iex(33)> Fib.fact 1000 402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 iex(34)> Fib.fact2 1000 402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 iex(35)> c "fib.ex" warning: redefining module Fib (current version defined in memory) fib.ex:1 warning: variable "m2" is unused fib.ex:17 [Fib] iex(36)> Fib.fib2(3) 3 iex(37)> Fib.fib2(4) 5 iex(38)> Fib.fib2(5) 8 iex(39)> Fib.fib(5) 8 iex(40)> Fib.fib2(40) 165580141 iex(41)> Fib.fib2(400) 284812298108489611757988937681460995615380088782304890986477195645969271404032323901 iex(42)> Fib.fib2(4000) 64574884490948173531376949015369595644413900640151342708407577598177210359034088914449477807287241743760741523783818897499227009742183152482019062763550798743704275106856470216307593623057388506776767202069670477506088895294300509291166023947866841763853953813982281703936665369922709095308006821399524780721049955829191407029943622087779296459174012610148659520381170452591141331949336080577141708645783606636081941915217355115810993973945783493983844592749672661361548061615756595818944317619922097369917676974058206341892088144549337974422952140132621568340701016273422727827762726153066303093052982051757444742428033107522419466219655780413101759505231617222578292486081002391218785189299675757766920269402348733644662725774717740924068828300186439425921761082545463164628807702653752619616157324434040342057336683279284098590801501 iex(43)> nil iex(44)> nil iex(45)> spawn(fn -> send self(),42) ** (SyntaxError) iex:45: "fn" is missing terminator "end". unexpected token: ")" at line 45 iex(45)> spawn(fn -> send self(),42 end) #PID<0.176.0> iex(46)> recieve do x -> x end ** (CompileError) iex:46: undefined function recieve/1 iex(46)> receive do x -> x end ^C ^C BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution ^C ^C: Feb15 ; iex Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> parent = self() #PID<0.82.0> iex(2)> IEx.configure [colors: [eval_result: :black]] :ok iex(3)> parent = self() #PID<0.82.0> iex(4)> spawn(fn -> send parent,42 end) #PID<0.87.0> iex(5)> receive do x -> x end 42 iex(6)> receive do after 10 -> 0 end 0 iex(7)> receive do after 10000 -> 0 end 0 iex(8)> spawn(fn -> receive do x -> send parent,x+25 end end) #PID<0.92.0> iex(9)> child = spawn(fn -> receive do x -> send parent,x+25 end end) #PID<0.94.0> iex(10)> send child,17 17 iex(11)> receive do x -> x end 42 iex(12)>